Billionaire businessman Michael Bloomberg ended weeks of speculation — marked by a stunning mea culpa for his past defense of ‘stop and frisk’ — and formally declared himself a Democratic candidate for the White House on Sunday.

The media mogul, New York City’s last three-term mayor, declared to supporters in a launch video and statement, “I’m running for president to defeat Donald Trump and rebuild America. We cannot afford four more years of President Trump’s reckless and unethical actions.”

“He represents an existential threat to our country and our values. If he wins another term in office, we may never recover from the damage. The stakes could not be higher. We must win this election. And we must begin rebuilding America. I believe my unique set of experiences in business, government, and philanthropy will enable me to win and lead,” said Bloomberg, who had ruled out a presidential run as recently as March.

He faces a tough fight to win the nomination over top tier Democratic candidates like former Vice President Joe Biden and Sens. Elizabeth Warren and Bernie Sanders who have been campaigning for months, including five debates.

Bloomberg will enter tied for fifth place, polls show.

But Biden’s debate stumbles coupled with the unexpected strength of the twin far-left candidacies of Warren and Sanders left Bloomberg and his advisors worried Democrats could select a nominee unable to beat President Trump next fall, sources told The Post.

His advisors believe the mogul’s $52 billion fortune and willingness to self-fund means he can catapult himself into contention.

The ad released online and airing in key battleground states starting Sunday is part of the three-term New York mayor’s $34 million initial ad campaign announcing his candidacy.

“He could have just been the middle-class kid who made good but Mike Bloomberg became the guy who did good,” said a tweet linking to the video with the logo Mike Bloomberg 2020. “After building a business that created thousands of jobs, he took charge of a city still reeling from 9/11. A three-term mayor who helped bring it back from the ashes, bringing jobs and thousands of affordable housing units with it.”

He also trumpeted his work advocating for gun control measures and efforts to fight climate change.

It said the 77-year-old will “restore faith in the dream that defines us where the wealthy will pay more in taxes and the middle class get their fair share. Everyone without health insurance can get it, and everyone who likes theirs, keep it.”

The ad concludes: “Jobs creator, leader, problem-solver.”

Bloomberg’s official declaration follows two stunning reversals — and apologies — from the famously stubborn politician as he plotted his entry into the race.

The first came when he apologized for sexist remarks he made while leading his eponymous Midtown media empire through a spokesman.

His second, made in person last Sunday, stunned the city — reversing his decade of unquestioned public support for the NYPD’s controversial ‘stop-and-frisk’ policy that was ruled unconstitutional and fueled a political backlash that elected his successor, Mayor de Blasio.

Political experts said Bloomberg had to make the move to square his politics with the shifting debate across the country — and in the Democratic Party — over criminal justice and policing.

“Why did he do it? Bloomberg knows that to compete for the nomination he has to get a chunk of the African-American vote,” University of Virginia political science professor Larry Sabato told The Post. “It’s that simple. If you can’t compete for the black vote you might as well save your money.”

He added: “You’ve got to stop people from booing you. He wants to say, `I apologize for that but this is what I did for the African-American community.”

That wasn’t Bloomberg’s only political maneuvering in the run-up to Sunday’s announcement.

He nabbed ballot spots in two states with early registration deadlines, Alabama and Arkansas.

The online advertisements Bloomberg is funding target four states expected to be hotly contested during the 2020 election: Arizona, Michigan, Pennsylvania and Wisconsin.

On his campaign’s website Sunday, the billionaire Bloomberg highlighted an economy that is “tilted against most Americans,” a health care system that “costs too much and doesn’t cover everyone,” communities “ravaged by gun violence,” and a global climate crisis that is “growing worse by the day.”

Bloomberg also described a “cruel and dysfunctional” immigration system, schools that are failing students in an “increasingly high-tech world, and special interest groups that “corrupt” Washington and “block progress on all of these issues.”

Then addressing Trump by name, he said he challenged the president on gun violence and “won stronger gun laws in states across the country” and “took on Trump the climate denier.”

“I know what it takes to beat Trump, because I already have. And I will do it again.I’ve never shied away from a tough fight,” he said on the campaign site. “Defeating Trump – and rebuilding America – is the most urgent and important fight of our lives. And I’m going all in.”

Bloomberg recounted how his father never earned more than $6,000 in a year, and how his parents instilled in him and his sister the need for an education. He also reflects on being laid off at 39 and coming up with an idea to start a company – “so I took a chance.”

“Today our company employs 20,000 people and generates large profits, almost all of which go to helping people across the country and around the world. I’ve always believed in investing in our employees and treating them well. We pay employees very well and provide the best health care benefits money can buy. And if someone has a baby, they get six months of paid leave,” he said.

And noting how he was elected mayor of New York weeks after the Sept. 11 terror attacks, he wrote: ​”​It was a frightening time for our city and country. But we rebuilt the economy with new jobs and opportunity – for people on all rungs of the economic ladder.​”

Bloomberg has said the Sunday ad rollout will be part of a $100 million online ad campaign targeting President Trump.

They are expected to run through the primary season, regardless of Bloomberg’s personal political fortunes, aides told The Post.

Trump won all of the states in 2016, but public opinion polls have shown that he is vulnerable as the 2020 election shapes up.

Bloomberg earned plaudits from Democrats for pumping millions into the 2018 midterm elections to help the party’s candidates across the country.

The crowded field of Democrats vying for president has largely been focused on the primary contest.

Some Democratic leaders are growing increasingly concerned that a nasty primary fight won by the party’s progressive and liberal wings could give Trump a chance to gain ground in during the spring and summer.

The president’s reelection campaign has started spending heavily on online advertising, using the war chest he has already begun to amass to target general election voters.