The Enterprise travels to the Arcadia star system and the planet Motherlode when they get word that swindler and conman Harcourt Fenton Mudd is there. When Kirk and Spock beam down, they find Harry offering the local heavy-metal miners small crystals which he claims contains a guaranteed love potion. The miners are understandably skeptical and Harry has an attractive woman come out and fawn on him. He explains that for the potion to work, it is applied to the skin of the user and then they touch their victim.
The miners believe Harry's claim and start arguing over the price. Harry spots Kirk and Spock and welcomes his "old friends." Kirk informs him that he's under arrest, but Harry points out that Motherlode isn't subject to Federation law. The miners tell the Enterprise offers to get lost so they can make their purchase, but Spock informs them that Harry is tricking them. The Vulcan fires a beam on low stun at the "woman" causing the Rigellian hypnoid lizard to drop its illusionary form. As it scurries off, the miners advance on Harry with murder in their eyes. He hastily throws himself on Kirk's mercy as they pelt him with rocks, and the Enterprise officers beam up with the conman.
Once he's safe, Harry complains that Kirk tricked him and threatens to sue. They take him to the brig and call in Nurse Chapel to examine one of the bruises from a rock. She assures them that they'll be fine while Harry explains that he escaped the android planet and made his way across the galaxy, swindling everyone he came across. Finally he found the love potion and sold it to a thousand locals, but they immediately became ill. Harry claims that their unusual biochemistry caused the reaction and that otherwise it is perfectly safe. He wants to recover the remaining crystals from his ship on the planet but Kirk refuses.
Spock asks Chapel for a medical summary to attach to his arrest report. She tries to congratulate him on the arrest but Spock emotionlessly dismisses her thanks and walks away. Harry, watching the exchange, plays on Chapel's feelings for Spock and offers her what he claims is one last crystal that he kept hidden.
The Enterprise departs the star system and locates an uncharted star system with a binary sun and a Class M planet. Spock notes that it is both uncharted and rare and Kirk orders an orbital survey.
In the brig, Harry explains how to apply the love potion, and suggests that Chapel take it as a sample in the interest of science. Chapel reluctantly drops the forcefield and takes the crystal. He warns her that lab experiments will destroy it without yielding results, and suggests that she use it the way it was intended. Chapel finally gives in and applies it to her skin, and then starts to collapse. Harry comes out and catches her, and secretly takes her phaser and ID card. He claims that it's a side effect and Chapel orders him back inside the brig, turns off the forcefield, and then goes to find Spock. Once he's alone, Harry uses the stolen phaser to disrupt the forcefield, and then applies a photo of his face to Chapel's ID.
Chapel finds Spock in the rec room filing his arrest report. She "accidentally" stumbles and falls into his lap, but Spock doesn't respond to her touch. Realizing that she's been tricked, Chapel goes back to the brig and discovers that Harry has escaped, and that he stole her equipment.
In the shuttlebay, Harry uses Chapel's ID to get access to the hangar bay.
As Spock files his arrest report, he's suddenly surprised to discover that he has strong feelings for Chapel.
Chapel finds Harry in the shuttlebay, disarms him, and orders him back to the brig at phaser point.
On the bridge, Kirk and McCoy are astonished when Spock arrives and tells them that he's feeling strong emotions.
Harry suggests that the potion has a delayed effect on Spock because he's a Vulcan, but Chapel doesn't believe him. He runs for it, dropping more of his crystals, and Chapel fires and misses. The beam shatters the crystals and the fumes seep into the air vents. The nurse manages to sound the red alert just as Harry jumps her and knocks her out.
Arex brings up the shuttlebay on the monitors and Spock loudly worries that his beloved is in danger. Harry departs in a shuttlecraft before they can stop him and Spock insists on going to the planet to rescue Chapel, the woman he loves. Realizing that Spock can't be persuaded otherwise, Kirk agrees to beam down to the planet with him. As Kirk and Spock head for the transporter room, the love potion fumes filter onto the bridge through the air vents.
As Spock impatiently waits for the transporter officer to set the coordinates, McCoy comes in and tells them that the search party found two crystals in the shuttlebay. The doctor tells Kirk that they're receiving reports that the crew is acting strangely and the captain tells him to check on it. They beam down just as the fumes filter into the transporter room. Meanwhile, on the bridge, Scotty takes the conn and M'Ress tells him how attractive he is for a human.
Harry lands the shuttlecraft on the pilot and tells Chapel that he'll leave her off and then slip away. He figures that the Enterprise will eventually find her, and offers to make her comfortable. Chapel looks around the desert planet and points out that there are no signs of life. As they walk off, they're unaware that a nearby pile of rocks is actually a gigantic alien creature.
On the Enterprise bridge, Arex is playing a lute while Scotty sings to M'Ress. The Caitian communication officer maintains a loose trace on the two officers.
When Kirk and Spock materialize on the planet, Spock stumbles and Kirk catches him. Affected by the potion, which causes friendship in members of the same sex, the two men declare their undying friendship to each other.
The alien creatures wakes up, crushes the shuttlecraft, and goes after Harry and Chapel. Kirk and Spock arrive and combine phaser fire with Harry, but the beams have no effect on the creature. The noise wakes up another similarly- creature, which starts lumbering toward them. Spock runs to Chapel and embraces her, calling her "darling."
Kirk calls the Enterprise for beam up, but the transporter officer is busy dancing with a woman. The quartet runs for cover and Spock tries to fight the imposed emotions. Harry is surprised to discover that potion works after all.
On the Enterprise, McCoy is seducing a female crewman with tales of how he's saved everyone on the ship at one time or another.
Kirk demands answers about the potion but Harry admits that he has no idea how long it lasts because he never thought it worked. Spock starts snapping at Kirk as the beneficial effects of the potion wear off, and sarcastically suggests that they appeal to the creatures' better natures. Kirk gets an idea and Harry reluctantly gives him the last two crystals in his possession.
On the Enterprise, the love effect starts to wear off, leaving the crew with equally strong feelings of hate toward each other. They finally hear Chapel hailing them from the planet below.
While Spock and Harry open fire on the first creature, Kirk runs out and throws the crystals into its mouth. He then touches its skin and steps back. It hesitates to crush him, and then turns and attacks the second creature when it moves in. The Enterprise beams the quarter up just in time as the two creatures slam down on the spot where they were standing seconds earlier.
Later, Harry is back in the brigs confessing everything for Chapel. When Spock offers to help, she snaps at him. Spock points out that the love potion is a cheat, since it induces hate for a much longer period than the initial love. Harry chalks it up to experience and regrets the fact that he'll be getting rehabilitation therapy again... because he'll have to leave his "loved ones."