After months of complaints from Pennsylvania Attorney General Kathleen G. Kane that her criminal case stemmed from her war on pornography, a judge on Thursday said the porn drama could play no role in her looming trial.

Montgomery County Court Judge Wendy Demchick-Alloy forbade Kane from bringing it up when she defends herself against charges of perjury, official oppression, and other crimes.

Kane's lawyers initially argued that the entire case against her should be dismissed, contending it was payback for her crusade about the swapping of pornographic and otherwise offensive emails by officials using government computers.

In June, Demchick-Alloy rejected that argument after prosecutors derided Kane's pitch as a red herring unrelated to the real issues in the case.

On Thursday, Demchick-Alloy rejected Kane's fallback position. In a complex argument, Kane had asked more narrowly to tell the jury about the porn to rebut the idea that she illegally leaked confidential information to attack a critic, former state prosecutor Frank Fina.

Her lawyers wanted to argue that if she had wanted to harm Fina, she could have done so by tying him to the troubling emails. The judge closed the door on that line of argument, too.

Kane is to go on trial Aug. 8. Prosecutors say she unlawfully leaked documents and then lied about her actions under oath.

Kane has admitted approving the release of material involving Fina, but she did it in a lawful way and told the truth about it later.

A key witness against her is expected to be political consultant Josh Morrow, who passed along agency documents involving Fina to a reporter for the Daily News.

While Kane told a grand jury she provided Morrow with little information about the leak, Morrow testified otherwise, supporting a perjury charge against her.

According to prosecutors, Morrow also detailed Kane's role in the leak in a contemporaneous phone conversation with a friend - a call recorded by the FBI in an unrelated probe.

Kane sought to bar the use of that recording at trial, but Demchick-Alloy rebuffed her on that, too.

And in the last significant pretrial ruling, the judge refused Kane's request to bar Morrow from telling jurors she had asked him to gather negative information on another political enemy, Philadelphia District Attorney Seth Williams. 215-854-4821