SANTA MARIA, Calif. The prosecution in Michael Jackson’s child-molestation case dodged a legal bullet yesterday when a judge ruled a shrink who could have given damaging testimony didn’t have to spill his guts after all.

Stan Katz – who is Jacko’s young accuser’s psychologist – was asked on the stand if he was also the therapist for Bradley Miller, a private detective whose office was raided by prosecutors building a case against Jacko.

He refused to answer, citing patient-client privilege, and the judge agreed.

The Gloved One’s lawyers have been trying to get key evidence found in the raid thrown out because Miller worked as a private eye for them – and they believe information the evidence uncovered was protected by attorney-client privilege.

Prosecutors, however, say they did not know Miller worked for the defense, and thus the evidence found against Jackson could be used at trial.