Randy Marsh is determined to make sure that Stan wins the annual state Pinewood Derby. He slips a device into the rear end of the car in order to give it an advantage. Stan learns from a news report, much to his disgust, that the device is a superconducting magnet, stolen from the Large Hadron Collider by Randy, disguised as Princess Leia.
At the finals, Stan reluctantly lies to the scout leaders with Randy's help. Randy then speaks to their main rivals Mr. Hollis and his son Emmett where Randy discovers, to his shock, that the Hollis' car clocked 1.5 seconds.
At the finals, Stan lies at the check-in table (with Randy’s coaching), saying that he used only the parts in the approved Pinewood Derby kit. He wins first place, setting a new speed record; at the same time, the car shoots off the track and into space, reaching warp speed. Not long afterward, two NSA agents visit the Marshes and tell them that an alien species found the car and is on the way to Earth to make contact. A spaceship lands in South Park, but it's pilot is a supposed intergalactic criminal named Baby Fark McGee-zax, who demands that Stan and Randy build him a new warp drive while holding the entire planet at gunpoint. Everyone believes that they can do it using only the approved kit.
Meanwhile, Mr. Hollis, ashamed to have lost to Randy Marsh, commits suicide in front of his son, much to Emmett's horror.
Stan tries to persuade Randy to tell the truth about the stolen magnet, but Randy refuses because he does not want to look stupid in front of the whole town. As they keep working, an Intergalactic Police ship approaches Earth; McGee-zax cloaks his ship and drags Stan out of sight, leaving the townspeople to divert the officers’ questions until they leave. Even though the officers say that McGee-zax stole a large sum of "space cash" from the Universal Bank, no one admits to seeing him.
As Stan and Randy finish the car, at Randy's urging, Stan reluctantly stabs McGee-zax with a makeshift shank, seemingly killing him. The ship is promptly de-cloaked and found to contain the stolen space cash. Instead of calling the Intergalactic Police, though, Randy persuades everyone to keep quiet and divide up the money, buying the world leaders’ silence by giving them shares as well. Four days later, as Randy is trying to keep the peace among them, the two officers land in South Park again. They now know that McGee-zax landed here and Randy tells them of his death, but everyone denies finding any space cash — even though the country of Mexico has suddenly built many new hospitals and water parks. Randy berates the Mexican government for jeopardizing the cover-up with this spending spree after the officers have left.
While Stan glumly stares at his first-place trophy and the newspaper articles he has collected, almost every one of which shows Randy excited and himself uneasy, Randy is still trying to keep other countries from doing as Mexico did. Learning that Finland is about to tell the Intergalactic Police the truth, he persuades the rest of the world to wipe it out. The country is immediately destroyed in a nuclear missile attack. The Intergalactic Police pay a third visit to ask about the strike, prompting fake disbelief from the world that in turn rouses the officers’ suspicions. By this time, Stan has had enough of the deception, tells the truth about cheating in the Pinewood Derby, and returns his trophy; however, no one else on the planet is willing to confess about anything else that has happened.
McGee-zax emerges from the officers’ ship alive and well, having faked his death earlier, and reveals that the entire chain of events was a test to see if Earth was worthy of joining the intergalactic community. The space cash was only worth what the humans had decided it was worth, and were tested by the aliens to see if they would return the cash rather than keep it. Had they returned it, Earth would have become a member of the Federation of Planets. Unfortunately for the humans, they failed because they tried to conceal the fact that they hoarded the space cash. As punishment for failing that test so badly, Earth and the Moon are permanently enclosed in a gigantic, cubical force field and isolated from the rest of the Universe — to which Randy says, "Well, that sucks."