I, Mudd
Summary
Captain Kirk and the crew have a second run-in with the con man, Harry Mudd, this time finding him as the king of a planet of androids. The Enterprise is captured by an android which takes the entire crew to an uncharted planet in the galaxy. Kirk, Spock, Bones, Uhura, Scotty, and Chekov land with the android on the planet to find Harry Mudd as the King of the planet and about 200,000 androids to serve him. He reveals that the androids want to learn about and serve humans and demanded more specimens. Harry Mudd plans to leave the entire crew of the Enterprise behind and take the starship. By unraveling the weak points of the androids, the crew of the Enterprise damage the main control unit 'Norman', reprogram the androids to serve their original purpose of settling the planet, gain control of the Enterprise and leave Harry Mudd behind to live with the humorous androids.
Summary from Wikipedia, CC BY-SA 4.0.
Find out more
These links open the services in a new tab with the question pre-filled; the AI assistants may ask you to sign in. Their answers can contain errors.