If John Kerry has been working to achieve peace between Israelis and Palestinians, he just made a convincing case about how miserably he has failed.

So why would anyone think his 11th-hour, 8,709-word scolding to Israel Wednesday will suddenly move the ball forward?

Kerry believes only a two-state solution can bring lasting peace. Yet, “despite our best efforts over the years,” he admitted, that goal “is now in serious jeopardy. The truth is that trends on the ground . . . are destroying hopes for peace” and “leading in the opposite direction.”

A secretary of state with more integrity might offer his resignation, given such a failure. Not Kerry. He actually went on to lay out “principles” of a peace deal — one that exists mostly in his own mind and the minds of those who think like him, starting with his boss, President Obama.

Fact is, there’s no consensus on any part of the Kerry-Obama vision in the United States or the Middle East — and Team Obama knows it. Why else would they wait until the last three weeks of their tenure to make their plan public, and spell it out only after delivering a swift blow to Israel at the UN Security Council (on the Friday before Christmas weekend, no less)?

Here’s the core problem: Kerry and Obama suffer under the delusion that the parties to such a deal both want it. Yet Palestinians have had numerous opportunities — going back decades — to reach a compromise and have rejected it every time. Kerry himself noted that it was the Palestinians who nixed the United Nations’ 1947 partition plan, not the Israelis.

And while he spent most of his speech blasting Israel for putting a future agreement at risk by “expanding settlements,” Palestinian Authority President Mahmoud Abbas wouldn’t agree to talks even when Israel froze its settlement activity for 10 months in 2010. So settlements are clearly not the problem.

As a livid Israeli Prime Minister Benjamin Netanyahu put it, “For over an hour, Kerry obsessively dealt with settlements and barely touched upon the root of the conflict — Palestinian opposition to a Jewish state in any boundaries.”

Kerry claimed his administration wasn’t turning its back on Israel but instead preserving its “future.” Yet given his failures so far, what makes him think he knows better than Israel what’s good for the Jewish state? (Recall that the Obama-Kerry nuclear deal with Iran rested on similar conceits.)

“Friends need to tell each other the hard truth,” Kerry said, in attempting to justify his slap at the Jewish state. That’s true. But as Netanyahu rightly retorted, “Friends don’t take friends to the Security Council.”

How pathetic and harmful that after years of failure — not just on the Israel-Palestinian front, but throughout the world — Team Obama is now desperately looking to lock in terms and tie the hands of a Trump team that is vowing a new direction.

Frankly, that day can’t come soon enough.