If you understand the premise of this episode, that the black cat, witches, zombies skeletons, magic, etc. were derived from the aliens' mistaken interpretation of human nightmares, rather than human reality, then, this episode does make sense.
In trying to understand humans the aliens tapped into human nightmares which evidently do not occur in the alien species. So, they present the Star Trek cast with these black magic nightmares, assuming they are part of the human paradigm.
Still, it is done in a little campy, silly style which was common in the sixties. Nevertheless, I first watched this as a child and still love it. One of my big pet peeves about TV series is the lack of story diversity and I never felt that about Star Trek, this episode is a perfect example. Even as a child I understood that special effects in TV series was laughable (movies not much better), but I still dream of traveling the stars. The wonder of Star Trek and traveling is always meeting someone new and learning new things, it goes a long way to reducing bigotry and increasing compassion.