By the way, reading one of the numerous bad reviews of this episode, I found this interesting bit
Gene Roddenberry ended up firing Mayberry midway through production, and Les Landau was brought in to finish it up. Mayberry getting fired is an undisputed fact, but the exact reason why he was let go changes depending on who you ask.
For example, prolific Star Trek novel writer Keith DeCandido later said that Mayberry was explicitly fired for his casting decision that needlessly transformed a bad episode into a racist episode. Meanwhile, Wesley Crusher actor Wil Wheaton has a more salacious suspicion. He believes that Mayberry got the ax because he was acting racist towards the Black guest stars he went out of his way to cast.
This raises a question for me: how much leeway did a director have at the time in everything that went into creating an episode (within budget of course)? I mean, if they really thought it was problematic that he cast an all-black cast, why wasn't he stopped right away?