Well, it looks like the Doctor has to do something that happens frequently on Star Trek: confront a villainous computer.
That is what more or less happens. The mysterious “Oracle” is a computer that decided it really needed the Minyans’ genetic records that the Minyans need to recreate their race. Heck, Oracle does give the captured Minyan a pair of cylinders that looked like the genetic records, and the Minyans are getting ready to leave, but the Doctor, after giving Oracle a good, and very proper English, telling-off, takes the real genetic records back with him.
K9 also proves his worth by correctly identifying the fake cylinders as fission grenades, and those sound like something you don’t want on your spaceship. The Doctor then does the smart thing and goes to return the fake cylinders. Since Oracle thinks it needs the genetic banks due to faulty programming, the guards take the cylinders from the Doctor.
Credit to the Doctor: he tells the truth and says they aren’t the real banks, but the guards don’t believe him. The Doctor suggests they’ll regret that action. Then he and Leela get all the trogs to go with them back to the Minyans’ ship. And though the Minyan commander initially balks at taking all those extra people, the Doctor points out the Trogs are Minyans, the very people Jackson and Co. are supposed to protect, and when the planet explodes, that will give the ship sufficient momentum to get to their new colony home.
Please note that is “when” the planet explodes and not “if”.
So, the Oracle, the Seers, and those stupid guards all go boom. The planet goes with them, and the Minyans and Trogs are on their way to their new home. Will the Doctor stay to help?
Nah. He has other places to be, specifically the last serial to feature Leela as a companion.