The owner of a long-empty East Village building that once housed PS 64 has filed suit against the mayor, the city and the Department of Buildings for allegedly thwarting his attempts to develop it into a college dorm — claiming they are conspiring to benefit a wealthy Democratic donor, according to a new lawsuit.

Gregg Singer — who bought the structure in 1998 at public auction for $3.15 million with hopes of expanding it from five stories to 19 — says he’s been thwarted every step of the way by the city who has been influenced by wealthy hedge-funder, Aaron Sosnick, who happens to live in a penthouse in the building next door, the Manhattan Supreme Court lawsuit alleges.

In the years after Singer bought the building, the city kept placing more and more restrictions on what he could do with it, and now Singer is only trying to renovate the current structure since new zoning rules and historic and landmark designation stop him from expanding, the court papers say.

The DOB’s restrictions and slow approvals also made two lease agreements — first with Cooper Union and then with Adelphi University — fall through, the court documents charge.

Singer also claims that Mayor Bill de Blasio’s public statements have also warded off potential business deals and caused the bank to foreclose on the loan.

In October 2017, de Blasio said he wanted to buy the building, even though Singer says he never received an offer from the city.

At a Lower East Side town hall meeting at the time, de Blasio said putting PS 64 “in the hands of a private owner was a failed mistake. So I’m announcing tonight, the city’s interest in reacquiring that building.”

Then on Aug. 23, 2018, the mayor said at a media roundtable that Singer was being “exceedingly uncooperative” in the sale and said he’d consider using eminent domain to acquire the place, the court papers say.

Singer claims this prompted the mortgage company to foreclose a month later on the structure, which has been unused for 15 years. He is fighting the foreclosure in state court, legal papers say.

The suit, which raises similar allegations to a federal suit Singer filed last year, is asking a judge to let Singer finally renovate and lease it to a college. He also wants the city to stop issuing pricey emergency repair orders which would be moot anyway once he gets DOB permits to overhaul the place, according to the court documents.

Singer claims Sosnick is trying to buy the building himself and because of the foreclosure could get it for one-third of what it is worth.

“The Respondents have long since ceased to follow agency rules or administrative code or standard practices and instead have worked tirelessly to support the special interests of a highly secretive billionaire hedgefunder, Aaron Sosnick, lurking in the shadows behind sham organizations, secret lobbying agreements, political henchmen, and targeted misinformation campaigns, all for the singular goal of acquiring my privately owned property— the old P.S. 64,” Singer said in a 65-page accompanying affidavit.

Singer says in the court papers that the project has “suffered” because of “City Hall’s maliciously orchestrated campaign, aided and abetted — if not outright orchestrated — by Mr. Sosnick and his self-funded nonprofit … to force me to relinquish control of my property.”

Singer’s lawyer, Randy Kleinman, said, “The history of the Mayor’s actions toward the Singer property demonstrate his being in the hip pocket of powerful interests, his complete disdain for private property and his deep seated pervasive disrespect for lawful process.”

Singer brought a similar conspiracy lawsuit in federal court in January 2018 against the mayor, the city, Sosnick and others. That case is still pending.

Singer also brought a suit in 2017 over a permitting dispute which the judge dismissed saying he didn’t have jurisdiction to rule and the issue needed to be taken up with the DOB.

Sosnick — who is not a defendant in the new case — did not immediately return a request for comment. The lawyers repping him on the federal case did not immediately respond to an email.

“None of Mr. Singer’s previous cases have been substantiated in court,” said city Law Department spokesman Nicholas Paolucci. “His state lawsuit lacked merit and was dismissed, and we’re moving to dismiss his federal case. We’re carefully reviewing this new complaint and will respond further in the litigation.”

Andrew Rudansky, a rep with the DOB said, the agency has “never harassed this individual, nor done so at the direction of the mayor.”

The mayor’s office did not return a request for comment.

Additional reporting by Nolan Hicks