Comedy is such a subjective thing. What one finds hilarious, others think is dumb. I've read some of the comments here, stating that the humor/jokes in this ep are not very good. But I find the humor in this ep to be very witty and enjoyable.
But I've seen this before. Many times I've sat in a room with a group, watching a "comedy" movie, and everyone is rolling on the floor laughing, and I'm just sitting there wondering what they think is so funny. And go through the whole film and not even grin once.
It's all subjective.
For me, what I love about TTWT is it shows how our heroes do not take themselves to seriously, and are able to laugh at themselves and their situation. As someone else said, it shows that not every day in Starfleet is "save the universe", some days are just arguing with beaurocrats.
Some of this ep is "slapstick", (the bar fight). But some of the jokes are truly witty and not dumb (and some of this is in the delivery--I think this ep shows how the actors are good at comedy too, as we would see later in TVH. They have a good chemistry and comic timing).
I always loved Kirk's line to Barris, "People have disrupted stations before without being Klingon agents. Sometimes all they need is a title...Mr. Barris." And this joke does mean you have to have been paying attention and remember his introduction as "The Federation Under-Secretary in charge of Argricutural affairs in this quadrant". But mostly, it's Shatner's delivery and the twinkle in his eye as he says it. And that's just one example, there are many others.
It's certainly not the weightiest or most important episodes, but it's certainly one of the most fun to watch.