"Plato's Stepchildren" by Meyer Dolinsky
"We are responding to desperate distress calls from an unknown planet. My science officer Mister Spock is unable to account for this, since he reported no signs of life on the planet. It is rich in kironide deposits, a very rare and long-lasting source of great power."
Kirk, Spock, and McCoy beam down to the planet and are greeted by Alexander, a little person. He's forced to lead them to Parmen, the Philosopher-King of these people, who has a terrible infection and needs McCoy's help.
All the Platonians, except Alexander, have psychokinesis.
More exposition (which answers how these aliens came to call themselves Platonians): "When their planet novaed, millennia ago, they transported themselves to Earth in the time of Socrates and Plato. After the death of the Greek civilisation they idolised, they came to this planet and created for themselves a utopia patterned after it."
McCoy cures Parmen, who then asks him to stay as they have no doctors of their own. The Platonians cut off communication with the Enterprise and try to get McCoy to stay by humiliating Kirk and Spock. In Spock's case, they force him to laugh and cry, stirring up anger and hatred in him later that he must control. He definitely has problems recovering!
Eventually, Our Heroes realize the psychokinesis comes from concentrated kironide in the Platonians' blood, gotten from eating the local food. Alexander doesn't have it because it's broken down by the pituitary hormone, which he doesn't have enough of. McCoy is able to synthesize kironide and injects Kirk and Spock with it.
Meanwhile, Uhura and Chapel have been forced to beam down. The Platonians humiliate the four in order to get McCoy to stay - and for their own amusement. They're very sadistic and cruel from 2500 years of power. Eventually, Kirk and Spock have enough power to challenge and defeat Parmen. They go back to the Enterprise - with Alexander.
From this thread and others, I know A LOT of people dislike or even hate this episode. And the torture of Our Heroes (and Alexander) is tough to watch. But it's there to make a point: "Uncontrolled, power will turn even saints into savages, and we can all be counted upon to live down to our lowest impulses."
There are lots of pieces of invisible wire in this episode.

There are several points where I felt the writing was sloppy. Barbara Babcock is criminally underused, but her reactions to Spock guessing her age and to Kirk and Uhura kissing (she's practically orgasming!) are excellent. Shatner, Nimoy, Kelley, Nichols, and Barrett all do a terrific job with being puppets and fighting against it. Michael Dunn is EXTRAORDINARY, creating a sympathetic and principled character I truly came to care for. I'd say the performances save the episode.
The episode also shows why Plato's Republic would never work in practice.