A seasoned Allegheny County judge recused himself from a case after he practically accused a prosecutor of being a racist.

According to online reports, Common Pleas Judge Joseph K. Williams, who is black, rejected a deal to allow a white defendant — Jeffery McGowan, 24, to plead guilty in exchange for 3 months’ probation.

McGowan stood accused of fighting with a police officer during a traffic stop.

Assistant District Attorney Brian Catanzarite attempted to negotiate a plea deal of 3 months probation for McGowan who did not have a criminal record.

“Catanzarite for some reason comes up with I think ridiculous pleas whenever it’s a young white guy,” an exasperated Williams said from the bench. “I’m just telling you what my observation is. If this had been a black kid who did the same thing, we wouldn’t be talking about three months’ probation.”

A shocked Catanzarite explained that he was standing in for another prosecutor, who negotiated the case.

“Now that the court has essentially called me a racist, I think that’s unfair. I don’t make offers based on race. I make offers based on facts,” Catanzarite said.

Another attorney in the courtroom at the time, Giuseppe Roselli, questioned whether Williams was rejecting the plea because McGowan is white.

“Not because he’s white, but because it’s a ridiculous plea that only goes to white boys that come into this court for the same facts, and I’m not going for it,” the judge responded.

After Williams recused himself from the case, Mike Manko, a spokesman for District Attorney Stephen A. Zappala Jr., said the plea deal was appropriate and agreed to by the officer, who was not injured.

“Negotiated pleas are never based on the race of a particular defendant but rather on the behavior of the defendant and the facts associated with that behavior,” Manko said.