Oops: Mayor Bloomberg has let spending on unions skyrocket -- now he must roll it back.

The inevitable is finally happening: New York’s failure to fix spending is endangering decades of progress in public safety and infrastructure.

Taxpayers won’t stick around for shootings and derailments. It’s time for Mayor Bloomberg to do the job New York needs him to do: cut union spending to keep the city livable.

Last week brought three pieces of worrisome news:

* Violent crime is rising: Murders are up 22 percent this year; shootings, 21 percent. Bloomberg said in response that “We have fewer police officers than we did before.”

We’re about to have fewer. As the mayor slashes the budget, the NYPD force will stand at 32,817 — down a quarter since 2000 and close to the number we had in 1990, when murders were four times today’s.

* Transit service is going down. The MTA, stuck with higher labor costs thanks to Albany, is slashing its budget and hiking fares for a third time in four years.

New Yorkers will be crowding onto fewer trains that break down more often. They’ll face chaos in stations, as token-booth clerks disappear, inviting crime and leaving confused tourists in the way.

* Manhattanites are leaving. In 2009, a net 2,545 residents decamped. Manhattan hadn’t lost population since 1992 — and, between then and 2008, gained nearly 10 percent, or 150,000 people.

The bill for fiscal denial is coming due. For 25 years, an ever-growing Wall Street lulled New York into thinking that it could afford everything.

Bloomberg doubled down on this belief. He avoided labor reforms, like pushing public-sector benefits costs in line with what little people get. So cops retire in their 40s and civilian workers in their 50s — all with great pensions and health benefits.

Playing nice with the unions is how we get a $63.6 billion budget — more than 25 percent higher than when Bloomberg came in (adjusted for inflation).

Even now, with services declining, spending is still on the rise, by more than 10 percent over two years.

This year, New York will spend nearly $25 billion on pensions, health benefits and Medicaid alone — plus the debt we need to pay it all and still have some infrastructure. That’s more than half of city tax revenues — and twice what these categories cost us (also after inflation) eight years ago.

And it wasn’t just benign neglect: Bloomberg made problems worse. Thanks to 43 percent raises for teachers, the Department of Education payroll alone — now $10.1 billion — is nearly one-sixth the entire budget. For overseeing this spending, 553 administrators earn more than six figures each — $70 million.

Thanks to Washington stimulus and bailouts, it’s taken a while for cracks to show — but they’re spreading.

Crime can rise quickly. One un-prevented murder can spawn two revenge murders. In response to a vicious high-school stabbing in Hell’s Kitchen a few weeks ago, cops deployed extra resources to prevent more stabbings. That costs money that we have to spend.

Quality of life can deteriorate fast. An unmanned subway invites vandalism. Cops trying to deal with that can’t tackle bigger crimes.

Think New York can’t return to the bad days? Spend a couple of hours at the Port Authority late Friday night — where lots of people spend their late nights and early mornings hustling or looking for confrontation. The prostitutes and pimps sure haven’t vanished, either.

Order doesn’t keep itself. If safety and infrastructure deteriorate, New York won’t be able to count on the incessant influx of young people it needs to pay for public-sector giveaways. The city needs the new blood to replace people who get tired of being pumped dry and leave.

New York pols, Bloomberg among them, wait for a miracle. How else to explain the “contingency” budget he threatened in January if Albany doesn’t come through with cash it doesn’t have? It would cut 3,150 more cops, eliminate street cleaning and slash libraries and parks.

Do they think that we have no choice but to live here?

If there’s a miracle in the offing, it’ll be disguised as a catastrophe. Thanks to bailouts, Wall Street looks like it’s doing great. But that means that the entrepreneurs that the city needs are feeling a double squeeze: Real-estate and other private costs are still too high to start a business — yet even Wall Street income isn’t high enough to cover the city’s needs, so we get hit with more taxes, like the new MTA payroll tax and higher city sales taxes.

The mayor has to re-work his budget in the next few weeks. He should stop trying to make more room for impossible benefits and education costs.

Sure, Bloomberg has talked about getting givebacks from the unions — but nobody will listen until he does something.

The mayor has gotten us into a mess on education — and getting out will be ugly. He should slash thousands of teachers starting now, doubling class sizes — then tell outraged parents: If you want the teachers back, call the union.

Yes, Albany controls subway service, and future city pensions — but that doesn’t leave our multibillionaire mayor helpless. The Legislature is up for grabs this fall; Bloomberg should say he’ll aggressively support candidates who promise to fix the pension mess and the rules that govern labor agreements.

It’s going to take dirty work to keep New York clean and safe.

Nicole Gelinas, Manhattan In stitute fellow, is author of “After The Fall.”