The Enterprise visits the planet Dramia to deliver medical supplies and improve diplomatic relations. The Supreme Prefect and his advisors holding a departing ceremony but then conclude by having Security Commander Demos present Kirk, Spock, and McCoy with a warrant for Dr. McCoy's arrest. The Dramians claim that McCoy caused a plague on their colony world of Dramia II, wiping out the population. Kirk has no choice but to honor the warrant and allow the Dramians to arrest McCoy. Kirk and Spock meet with Demos, who insists that McCoy will receive a "fair" trail. Kirk is skeptical and goes to visit McCoy, who isn't so sure. Kirk says they'll go to Dramia II to investigate. Once Kirk and Spock depart, the security guard reports what he's overheard to Demos, who pursues the Enterprise in a one-man spacecraft.
En route, Spock checks the records and determines that the plague cause pigmentation changes in its victims, and Vulcans are immune. Sulu detects Demos' ship and Kirk orders him to open the hangar doors. Demos assumes no one is aware of him and enters the shuttlebay, only to find Kirk and Spock waiting for him. Demos protests and Kirk promises to notify the Federation… later. Meanwhile, they'll hold Demos as a stowaway and proceed to Dramia II.
The Enterprise passes through an aurora which Spock determines has unique radiations but is non-lethal. Kirk and Spock take Demos down to the planet and spot one survivor. They chase him through the ruins into a series of underground tunnels. The survivor turns and attacks Kirk, but he's easily defeated. Demos explains that although the plague left no survivors, a few colonists were off-planet. When they returned, they chose to live among the ruins with the corpses of their kinfolk. However, one survivor confronts them: Kol-Tai. He says that McCoy inoculated him for Saurian virus and somehow he survived the three color-stages of the plague: blue, green, and red. Kol-Tai refuses to believe that the man who saved his life would spread plague and is more than willing to go back to Dramia to testify.
The ship departs for Dramia, passing back through the aurora. Kol-Tai is taken to Sickbay for a medical exam, and they discover that he has the plague. They order a quarantine but too late: first Kirk and then everyone but Spock turn blue from the plague and start to collapse. They arrive at Dramia and Spock orders General Order Six, self-destructing the ship 24 hours after everyone is dead.
Spock contacts the Supreme Prefect who demands to speak to Demos or Kol-Tai. Both are incapacitated and unable to talk, and the Supreme Prefect refuses to release McCoy to treat the plague. Spock informs Kirk, now in the "green" stage of the plague, that he is beaming down on his own to free McCoy. The weakened Kirk mans the transporter controls and beams Spock down. The Vulcan knocks out the security guard and frees McCoy, and Kirk beams them back before collapsing.
With the crew entering the third and final stage of the plague, McCoy and Spock check the records but can find no description of a similar plague. The radiation from the aurora interferes with McCoy's medical equipment, and Kirk realizes that the aurora is the key. McCoy has Spock check the records for symptoms excluding the color changes, and they find a similar disease. The color changes are caused by the aurora, not the disease. McCoy remembers there was a similar aurora 19 years ago, proving his innocence. However, Spock reveals that there is no known antidote for the disease. He notes that McCoy inoculated Kol-Tai for Saurian virus, and the Dramian survived the first onslaught of the disease shortly thereafter.
McCoy uses Saurian virus antibodies to cure the crew and the Dramians clear McCoy of all charges and honor him for making their world safe from the disease. The Supreme Prefect and Demos agree to ignore Spock's actions in return for Kirk dropping the charges against Demos for stowing away. As they beam aboard, Spock gently mocks McCoy for getting behind on his vitamin treatments for the crew.