Eva Moskowitz has committed the ultimate sin in public education: Her charter schools are wildly successful.

The United Federation of Teachers, you see, has much to lose from successful charters, public schools that are most often non-unionized. Especially when the charters sit right next to their union counterparts, shining a light on the union’s failures. With Democratic mayoral wannabes now vying for the UFT’s support, the attacks are coming fast and furious.

At the moment, the union is targeting “co-location” — i.e., having charters and union schools share space in the same building. Charters need co-location because they don’t get public funding for buildings, so the only space available is in existing schools. The unions understand that if you end co-location, you stop charters cold.

No doubt that helps explain why Dems desperate for UFT support are now attacking Moskowitz. Public Advocate Bill de Blasio, for example, this week accused the city of favoring one of Moskowitz’s charters over the schools it shares space with.

“Time and time again,” de Blasio claimed, “we’ve seen a tale of two cities, with resources lavished on [Moskowitz’s] Success Academy while traditional public schools in the same building lacked the most basic necessities.”

The truth is just the opposite: Union schools get tons of cash, while charters are left begging. At the schools de Blasio cited, the city recently spent $2 million in the union section, and $350,000 for the charter.

Meanwhile, here’s what de Blasio didn’t talk about: the differences in student achievement. At Success Academy Harlem 4, some 98 percent of third-graders passed the state math exam, while just 9 percent did at its unionized neighbor. In English, 87 percent passed at Moskowitz’s charter, while no one did at the union school.

The figures are likewise lopsided citywide: 96 percent of Moskowitz’s kids passed math and 88 percent passed English, versus 30 percent and 20 percent respectively at union schools. Wouldn’t it be nice to have a New York where it was a sin for a school to fail rather than succeed?