President Obama will surely put his best spin on his legacy Tuesday in his eighth and final speech to the United Nations General Assembly. But even his biggest fans must struggle to ignore the spread of mayhem on his watch, in the Mideast and beyond.

The president is likely to highlight his oh-so-historic diplomacy, from that (toothless) global climate agreement to the improvement, such as it is, in the world’s economy. Plus, of course, the nuke agreement with Iran and the opening to Cuba.

So how fitting that as Obama speaks in New York, Iranian President Hassan Rouhani will be completing a trip to Cuba and Venezuela, before giving his own UN speech Thursday. After all, these rogue nations have come together and, in Cuba’s and Iran’s cases, come in from the diplomatic cold thanks to Obama.

Similarly, the Obama-Hillary Clinton “reset” with Russia has left that nation far more aggressive than in 2008. China, too, is pushing hard in the Pacific, despite Obama’s much-announced “pivot to Asia.” In his UN speech eight years ago, Obama promised action on perennial UN priorities — including, of course, making peace between Israel and the Palestinians.

That unfulfilled goal proved to be a sideshow as the wider Mideast underwent tremendous changes through the Arab Spring — a brief surge of democracy, followed by chaos.

And as the Mideast (Israel excepted) became even more of a mess, America became a spectator.

Take the refugee crisis. During the last decade, according to the United Nations, the number of people fleeing wars around the world jumped from 37 million to 66 million — most of them from the Mideast, and many flooding Europe.

European policymakers are at a loss for answers, and Syria’s neighbors — Jordan, Lebanon and Turkey — are struggling to handle the inflow.

But not to worry. Obama’s on the case. While at the UN assembly, he’ll host world leaders in a conference on migration. They’ve already reached an understanding to talk about it further and may even, in two years or so, reach a global treaty (which will surely be too weak to make a dent in the growing problem).

It’s a problem, so they’ll talk about it, and talk about talking about it some more.

Meanwhile, in Syria, the eye of the refugee storm, America is losing its last trace of dignity. On Monday the Syrian army announced an end to that cease-fire declared just a week ago by Secretary of State John Kerry and his Russian counterpart, Sergey Lavrov.

The Kerry-Lavrov pact was doomed from the start, but the death blow came late last week when US planes bombed forces loyal to Syria’s butcher-in-chief, Bashar al-Assad. The Obama administration rushed to apologize, swearing it was a mistake.

Remember when Team Obama said Assad must go? That policy, we learned over the weekend, secretly became a dead letter two years ago: It was back then, Russian UN Ambassador Vitaly Churkin disclosed, that the United States “committed,” in an agreement with Damascus, that our airstrikes in Syria “would not affect” Assad’s army.

We became, in effect, an accomplice of Assad, the world’s most prolific killer.

One chief reason: our desire to secure an agreement with his main regional backer, Iran.

That agreement was supposed to be the crown jewel in Obama’s attempt to promote a nuke-free world. Yet, eight years after he announced that goal at the United Nations, North Korea’s arsenal grows as it tests new nukes with added frequency. And under Obama’s deal, Pyongyang’s ally, Iran, is on the road to joining the growing club of nuclear-armed countries.

Meanwhile, Iran wages proxy wars with rival Saudi Arabia; consolidates its Syrian and Lebanese bases to assure a presence near the borders of the country it vows to annihilate, Israel; and stretches its tentacles as far as Africa and Latin America.

And America shies from confronting Iran for fear Tehran might walk away from the nuke deal. So instead, the West lifts sanctions and enriches Iran’s leaders.

A top promise of the Obama presidency was that, as a global child (African roots and Indonesian childhood), he’d unite the world and help nudge it toward the ideals the United Nations was originally meant to espouse.

Yet while America toiled these last eight years to strengthen global institutions like the United Nations, America’s global leadership has waned. The world is worse off, and so are we. But you won’t hear that part in Obama’s speech.