There's certainly room in Star Trek for humor. I personally prefer it to come out of the characters. Banter, familiarity, tension relieving comments are part of what makes us what we are and part of what makes the first 3 TOS movies my favorites.
Star Trek always had that. Some episodes have more, some have less.
Gene liked his show to be pretty serious and I respect that. Some of my favorite episodes are 99.9% dead serious. Then two important things happened to make the show lighter; first was Gene Coon's arrival. he had a sharp sense of humor and he brought that to his writing and producing chores. Second was the recording and use of the score to "Shore Leave" (which was fantasy and had a little whimsy but was still pretty serious) and the library cues of Joseph Mullendore. Suddenly the music was light as a feather, accentuating (sometimes overly so) the humor and character bits. Without a single overt full comedy episode, Star Trek got more humorous. A lot of "Tomorrow is Yesterday" is light and the music has a lot to do with it.
The second season gave us show filled with confidence and firing on all thrusters. Characters bantered and joked. But then we still had "The Doomsday Machine" - square in the center of the Coon era - with nary a joke in sight.
As I've said too many times, "The Trouble With Tribbles" works for me because the situation is serious, but the problem is conversely cute, so the characters react to that. 90% of the jokes land and nobody pretends to be a gangster or makes invisible bombs while singing. Everyone stays in character. So, yep, I enjoy it. Although, I'm not the biggest fan of some of the music. Comedy in the 60's was often backed by "funny" music and Star Trek was no exception.
So now we have absurdity to deal with: why do I like "Bread and Circuses" and not "A Piece of the Action?"
The style. B&C is treated seriously and the humor is in the satire targeting the TV industry (probably some of Gene Roddenberry's sharpest comedy). APOTC is a serious situation at its core, but it's an absurd concept, played absurdly and with cutesy music. "I, Mudd" is easily my pick for worst of the comedies because it's over the top, scored poorly and everyone has to act wildly out of character, which I found funny at 8 years old, but don't now.
So those episodes I think eroded the original vision. So Roddenberry wanted all that scaled back. Now, I - like - the John M. Lucas episodes. I felt he caught the concept and had a good bit of lightness when necessary, but brought Kirk back to his more doubtful persona ("The Ultimate Computer" is the crowning achievement of that group). It was more serious than the Coon shows but that's what sold the high concept stories.
It is one thing that Irwin Allen really got right in "Voyage to the Bottom of the Sea." Other than like 2 episodes out of 110, every episode was played straight. No matter how over the top, bizarre or just plain stupid the threat of the week was, everyone played it with a straight face. And that was the only way to accept it.
"Patterns of Force" is no less ridiculous than "A Piece of the Action" in concept but it works better for me because it's dead freaking serious, with only some light bits here and there to make things less tense (McCoy's boots, Melakon's appraisal of Spock, etc).
The third season did away with almost all humor which was probably an overreaction, because it felt like Kirk was on the outs with his crew after a season and a half of familiarity. But I still liked it and took those really dodgy episodes more seriously because of that tone.
So, the upshot: humor is fine. All out comedy episodes are fine...once in a while. The more episodes per season you have, the more you can do. Those days, you could do three and get away with it. These days, not so much. So, yes, humor please, not gags.