Harry Mudd is a real scoundrel. Guess what he is up to now? He crash landed on a planet filled with androids, and he is the ruler now, because he has human ideas and feelings which the androids need in order to survive. So Harry dispatches the lead android, Norman, to take over the Enterprise and bring them back to this planet so that Harry can leave (living with only androids is not fun) and Kirk and his crew can look after the androids. It is the only way that the androids will let Harry leave.
It doesn't sound like a bad place. You can have unlimited female and male slaves, even hundreds of a particular design that you like, and they will serve you forever. but Harry was so bored he created an android of his "wife" from back on earth, named "Stella" who he keeps just so he can tell her to "shut up" and of course she must obey.
But guess what? Once the enterpise crew is kidnapped, the androids still won't allow Harry to leave. Norman, and two girls who are identical named Alice try to make them happy, but no one is allowed to leave. So Kirk and Spock come up with a plan, which Harry, who is also a prisoner, agrees to.
First Uhura pretends to want an immortal android body, so that the androids will be off their guard. Then the crew, along with Harry, use illogical statements to confuse the androids and force them to shut down, including the smartest android, Norman. They quickly conquer the androids.
And to say thanks to Harry for dragging them here, Kirk puts Harry back in charge. Harry looks at all the beautiful female androids and thinks "it's not so bad" but then Kirk unveils the new series of androids, the "Stella" series (Harry Mudd's wife) which have now been programmed to talk nonstop and never shut up, even when they are ordered to by Harry. A fate worse then death. All of the crew laugh. Wow. All is resolved.