A special prosecutor has been named to investigate a Staten Island lawyer who is accused of creating phony Facebook accounts to masquerade as borough politicians and candidates.

Thomas Tormey Jr. — a criminal defense lawyer and former Manhattan prosecutor — has been appointed to probe the dirty political tricks of Richard Luthmann.

Staten Island District Attorney Michael McMahon asked to be relieved of handling the case to avoid the appearance of a conflict because he was allegedly one of Luthmann’s victims.

In the order signed Aug. 21 — but made public Tuesday — the target is referred to as “John Doe.” Sources familiar with the case identified the target as Luthmann.

The order refers to investigating “allegations of violations of criminal impersonation in the second degree, forgery in the third degree, and falsifying business records in the second degree.”

Luthmann, who once infamously challenged a legal opponent to a trial by combat, was outed by NY1 last week.

The report cited outed Luthmann as the provocateur who smeared former Republican Assembly candidate Janine Materna, Democratic Councilwoman Debi Rose and McMahon.

Materna had filed a complaint last year over the harassment and threats triggered by the phony site, which listed Luthmann as the administrator.

One post on the phony Facebook page is a photoshopped image of Hillary Clinton standing next to Materna.

The bogus page in the name of Debi Rose falsely claimed the councilwoman was in favor of a “heroin-methadone den” in her district.

The McMahon campaign was lampooned as a Mafioso crime family and listed his wife, Staten Island Administrative Judge Judith McMahon as the head of it.

Luthmann said on Tuesday he had “no comment” and would consult with his personal lawyer on the criminal matter.

But Luthmann has continued launching attacks against his alleged victims with rants on Facebook this week.

“One man’s dirty trick is another man’s civic participation. #BitterJanineMaterna and her cronies should be happy that her comatose political career is now off life support for the time being,” he said in on Facebook post.

A spokesman for DA McMahon declined comment.