If we're thinking of the same episode, Patterns of Force, it's actually a contemporary alien planet (where everyone looks pretty much like humans because, STAR TREK) where a federation historian has somehow ended up and turned the planet into a rehash of nazis out to exterminate some really thinly disguised space jews, under the extremely stupid belief that the nazis would actually work out pretty well if they hadn't been totally evil as all hell. It was probably a pretty brave if rather flawed episode at the time, plus it also managed to have a budget of fuck all since they just hauled out all paramounts nazi costumes and space nazi chancellery was just the Desilu offices with some big swastika flags draped all over it.