Norman, an android pretending to be a member of the U.S.S. Enterprise crew, takes control of the starship and her crew, taking them to an unnamed planet where Kirk discovers an old nemesis ... Harry Mudd.

Fleeing from his most recent criminal exploit, Harry crash-landed on the planet, which is inhabited by androids designed by a long-extinct race. At first their desire to fulfill his every need seemed like paradise, but Harry soon realized that precluded him ever leaving the planet. So, sending Norman to capture the U.S.S. Enterprise, Mudd hoped to trade the starship's crew for his own freedom.

The androids, however, want to use the U.S.S. Enterprise as a vehicle to populate the universe, serving mankind and protecting them from themselves. Unwilling to spend their lives on the strange planet, waited on by machines, Kirk and company set about finding a way out. It is not without temptation, however.

Spock is shown what is supposedly the control center for all the androids ... a veritable electronics dream come true. McCoy is given an extensive lab, set up to do all the research he's ever wanted to do, while Scotty is shown the technical machine shop of his dreams. The androids offer Uhura eternal youth and beauty while Chekov contemplates a planet filled with beautiful young women.

In the end, however, the crew bands together in an attempt to thoroughly confuse and, ultimately, short-circuit them. Through a series of illogical and very funny antics, the U.S.S. Enterprise crew and Mudd cause Norman, the central control for all the androids, to have an electronic "nervous breakdown."

Instead of granting Harry Mudd his freedom, Kirk leaves him on the planet with the remaining androids ... including many fashioned in the image of his shrewish wife, Stella, until he mends his ways.