After shaming the city’s “worst landlords” for years, Public Advocate Letitia James is hauling in donations for her state attorney general campaign from developers, management companies and other real estate interests.

The real estate industry has donated at least $213,655 to James’ AG bid since May, a Post review of state campaign filings shows. That’s nearly one fifth of her total $1.16 million haul though mid-July.

Sixteen limited liability companies in real estate gave $64,500, including an LLC under big city developer Two Trees. Donors linked to real estate firm and film studio developer Steiner NYC have given $15,100.

The wife of real estate mogul Gary Barnett gave $10,000. His company, Extell Development, sued the state attorney general’s office in 2010 after then-AG Andrew Cuomo said it had to let condo buyers out of their contracts.

Eugene Schneur, of development company Omni New York, put up $10,000 for James, while billionaire real estate investor Alexander Rovt gave $5,000. Neighborhood Preservation PAC, a pro-landlord group, donated $5,000.

The attorney general’s office enforces rules over co-op and condo sales and probes real estate fraud and other violations. The office is part of a tenant harassment task force and has prosecuted property owners like Steven Croman, the so-called “Bernie Madoff of landlords.”

James touts the passage of City Council legislation forcing landlords to improve conditions on her campaign website. As public advocate, she releases an annual list of the city’s “worst landlords.”

The campaign said it ensures no donations come from those landlords or other bad actors, particularly in the real estate industry. Tenants PAC, which advocates for tenants, endorsed James in June without a formal announcement.

Spokeswoman Delaney Kempner said James is supported by a “broad spectrum of New Yorkers” because they know she’ll fight for them.

James also took in at least $369,815 from unions and other labor interests, and at least $80,650 from the construction industry. Lawyers and law firms put up at least $78,225.