Re: TOS and purely comedic episodes
DS9: Little Green Men is a genuine farce.
Star Trek didn't have a good comedy track record in the 24th century for some reason. About the only time they worked were the DS9 Ferengi shows but even those are hit or miss.
Dr. Howard, Dr. Fine, Dr. Howard: For duty and humanity! --Men in Black (1934)