Michael Bloomberg’s presidential campaign isn’t ­going as planned. He was a piñata in his first two ­debates and his decision to skip the four early states looks dicey as polls show him trailing in crucial Super Tuesday contests.

Some of these headwinds were predictable, which is why Bloomberg hesitated to join the race. ­Until the moment he started running, he was telling friends there was no place for him in the Democratic Party.

He may have been right, but Bloomberg was dead wrong in the way he tried to improve his odds. His abrupt decision to apologize for New York’s stop-and-frisk policing undercuts core rationales for his candidacy without curbing his rivals’ appetite for criticism of the policy. He grovels and begs for forgiveness and still they tar him as a racist.

The issue remains potent because of the left’s obsession with identity politics and because Bloomberg vigorously defended stop-and-frisk until he decided to run for president.

Infamously, he said in 2015 that he had “put all the cops in minority neighborhoods” because “that’s where all the crime is.”

He continued: “And the way you should get the guns out of the kids’ hands is throw them against the wall and frisk them.”

There is no record of him ever again using the inflammatory phrase “throw them against the wall,” but otherwise there was nothing exceptional about that speech. He praised the policy scores of times and was wedded to it throughout all 12 years of his mayoralty.

The obvious conclusion, that he is flip-flopping now in a cheap pander for leftist votes, is true as far as it goes. But a far larger issue is that, in saying that stop-and-frisk was racially biased, Bloomberg betrays the very NYPD that made him successful. Every man and woman who wore the uniform during his tenure — black, white, Asian and Latino — now stands implicitly accused of carrying out a prejudicial policy.

And what of the officers who died in the line of duty? Were they racists?

Bloomberg’s cravenness puts him on the side of his successor, Mayor Bill de Blasio. Recall that de Blasio largely won the mayoralty in 2013 by railing against the NYPD and pointedly warning his biracial son about the police.

It sounds as if Bloomberg now agrees with de Blasio.

To be clear, this is exactly the opposite position Bloomberg took during his 12 years at City Hall and in the first six years after he left ­office.

For all that time, he repeatedly and correctly credited stop-and-frisk as being fundamental to the large crime reductions on his watch, which helped spur a terrific economic recovery. Worried that his successor would undermine those gains by dismantling the NYPD’s anti-crime strategies, Bloomberg began issuing weekly press releases with crime updates.

In bullish presentations, he called police officers “first preventers” and noted that falling crime led to a decline in the prison population.

Bloomberg boasts about those achievements as he seeks the White House, saying the leadership skills he showed in Gotham would benefit the entire nation if he were elected president.

Yet he renounces a key ingredient of his success and tacitly surrenders to the anti-police, sanctuary-city agenda destroying New York and other blue states.

His stop-and-frisk decision also casts doubt on whether Bloomberg could be a worthy commander in chief. Would he abandon the soldiers he sent into battle to appease the anti-American wing of the Democratic Party? Would he be willing to use the military if it could hurt him politically?

Bloomberg’s recent conduct is especially odd given that New Yorkers of all races were united in supporting the police during his tenure. Early in 2013, Bloomberg’s final year in office when stop-and-frisk was coming under court challenge, a Quinnipiac survey showed then-Police Commissioner Ray Kelly enjoying an astronomical 75 percent positive rating with just 18 percent negative.

Even black voters supported Kelly by 63 to 27 percent. Overall, the NYPD enjoyed a 70-23 approval, second only to its score in the aftermath of 9/11.

Bloomberg then had good approval numbers too, 56-37, though notably lower than Kelly’s and the cops themselves. But when he decided to renounce the department’s achievements, his apology reportedly came without warning or discussion with anyone in the Police Department.

It was as if his campaign team showed him a poll that said stop-and-frisk could hurt him, so he threw his record and everybody involved under the bus.

In contrast, the Mike Bloomberg who was an overall good mayor was not afraid of criticism over supposedly third-rail issues. He challenged municipal-union rules on seniority and pensions, seeded and nurtured the nation’s largest charter-school movement and fought to raise the quality of public-school teachers by denying tenure to those who failed their students.

These were politically perilous positions because of the unions’ large voting blocs, but Bloomberg explained that he had a distinct advantage. His wealth, he often said, gave him the freedom to act in ways that other politicians couldn’t because they had to curry favor with donors.

“I’m in a unique situation,” he told me in a 2011 interview. “I’m not going to run for higher office, which everybody keeps joking about but obviously that’s not going to happen. So I’ve got the ability to look at some of these challenging issues that nobody is willing normally to go after.”

Later, he added, “I don’t owe anybody anything, so I’ve really got nothing to lose.”

What happened to that Mike Bloomberg? Where did the independence go? He’s even richer now than he was then, but his 2020 campaign reeks like those ­bended-knee politicians he used to scorn.

Because he already has spent an estimated $500 million on ads and staff to gain an outsized presence on TV and digital screens, his ­rivals and others accuse him of trying to buy the presidency.

They are right of course. But his worst affront is not what he’s trying to buy — it’s that he sold out the gallant NYPD.

Signs of decline

Reader Roger Murray doesn’t like what he sees in the city.

He writes: “I had the ‘pleasure’ of visiting for dinner and a show and was amazed at the number of homeless at Penn Station and on the streets. There was open smoking of weed and vendors selling knockoffs were spreading their wares across the sidewalks as NY’s Finest stood by. We were vilified with racial comments for showing no interest in purchasing CDs by those hawking them in Times Square.”

Gipper’s a write-thinker

This being an election year, the many losing politicians can console themselves with an astute observation by Ronald Reagan.

“Politics is not a bad profession,” the late president said. “If you succeed there are many rewards. If you disgrace yourself, you can always write a book.”