The “Pooperintendent of Schools” has had his lawsuit dumped.

The ex-New Jersey superintendent outed as a school’s “mystery pooper” won’t be able to sue police for $1 million for releasing his mug shot, a judge has ruled.

Thomas Tramaglini, 43, raised a stink about the booking photo, and claimed it was illegally leaked to the press — even blaming it for the loss of his job as Kenilworth Public Schools superintendent.

But his lawsuit was flushed away Sept. 9 by US District Judge Anne E. Thompson, who pointed out that his reputation only went down the crapper because of the embarrassing, public nature of his crime.

Tramaglini was dubbed the “Pooperintendent of Schools” after it emerged that he had pleaded guilty to relieving himself under the bleachers near the Holmdel High School athletic field last year.

However, he insisted in his lawsuit that it was only the mug shot that drove his story to appear “around the world” — a claim the judge quickly unloaded on.

“The sensational media coverage he received seems to have stemmed from the evocative nature of Plaintiff’s public defecation charge — a charge to which he eventually pleaded guilty — coupled with the fact that Plaintiff was a superintendent at a different school district,” the ruling states.

“It can hardly be argued that but for the distribution of the Mug Shot … the sensational media coverage and Plaintiff’s termination would not have transpired.

“The disclosure of a mug shot itself does not reveal any information that was not already public,” the ruling stated.

The court docs say that high school staff had “found feces in various locations around the track and football field” on “several occasions,” leading to a surveillance op by cops.

When confronted in May last year, Tramaglini “immediately apologized” for his “immediate and emergent need to defecate” while running, the documents say.

He initially faced three charges, before pleading guilty to public defecation and paying a $500 fine in a plea deal.

Tramaglini’s attorney, Matthew Adams, told NJ.com that a new lawsuit would be filed in state court after the district court knock-back.

“Holmdel Township will be held accountable for its clear violations of established law,” he vowed.