The Gray Lady feels the agony of political defeat — in her reputation and in her wallet.

After taking a beating almost as brutal as Hillary Clinton’s, the New York Times on Friday made an extraordinary appeal to its readers to stand by her. The publisher’s letter to subscribers was part apology and part defense of its campaign coverage, but the key takeaway was a pledge to do better.

Times publisher Arthur Sulzberger Jr. admitted the paper failed to appreciate Donald Trump’s appeal.

“After such an erratic and unpredictable election there are inevitable questions: Did Donald Trump’s sheer unconventionality lead us and other news outlets to underestimate his support among American voters?”

While insisting his staff had “reported on both candidates fairly,” he also vowed that the paper would “rededicate ourselves to the fundamental mission of Times journalism. That is to report America and the world honestly, without fear or favor.”

Ah, there’s the rub. Had the paper actually been fair to both candidates, it wouldn’t need to rededicate itself to honest reporting. And it wouldn’t have been totally blindsided by Trump’s victory.

Instead, because it demonized Trump from start to finish, it failed to realize he was onto something. And because the paper decided that Trump’s supporters were a rabble of racist rednecks and homophobes, it didn’t have a clue about what was happening in the lives of the Americans who elected the new president.

Sulzberger’s letter alludes to this, promising that the paper will “striv[e] always to understand and reflect all political perspectives and life experiences in the stories that we bring to you.”

But bad or sloppy journalism doesn’t fully capture the Times sins. Not after it announced that it was breaking it rules of coverage because Trump didn’t deserve fairness.

As media columnist Jim Rutenberg put it in August, most Times reporters saw Trump “as an abnormal and potentially dangerous candidate” and thus couldn’t be even-handed.

That wasn’t one reporter talking — it was policy. The standards, developed over decades to force reporters and editors to be fair and to build public trust, were effectively eliminated as too restrictive for the Trump phenomenon.

The man responsible for that rash decision, top editor Dean Baquet, later said the Rutenberg piece “nailed” his thinking, and went on to insist that Trump “challenged our language” and that, “He will have changed journalism.”

Baquet also said of the struggle for fairness, “I think that Trump has ended that struggle,” adding: “we now say stuff. We fact-check him. We write it more powerfully that it’s false.”

Baquet was wrong. Trump indeed was challenging, but it was Baquet who changed journalism. He’s the one who decided that the standards of fairness and nonpartisanship could be broken without consequence.

After that, the floodgates opened, and virtually every so-called news article reflected a clear bias against Trump and in favor of Clinton. Stories, photos, headlines, placement in the paper — all the tools were used to pick a president, the facts be damned.

Now the bill is coming due. Shocked by Trump’s victory and mocked even by liberals for its bias, the paper is also apparently bleeding readers — and money.

I’ve gotten letters from people who say they cancelled their Times subscriptions and, to judge from a cryptic line in a Thursday article, the problem is more than anecdotal.

Citing reader anger over election coverage, Rutenberg wrote that, “Most ominously, it came in the form of canceled subscriptions.”

Having grown up at The Times, I am pained by its decline. More troubling, as the flagship of American journalism, it is giving all reporters a black eye. Its standards were the source of its credibility, and eliminating them has made it less than ordinary.

It is because of those concerns that I repeat a suggestion about how to fix the mess. Because he now concedes a problem, perhaps Sulzberger will consider taking action.

Using an outside law firm or even in-house reporters, he must assess how and why Baquet made the decision to sever the paper from its roots. He must assess the impact on reporters and editors, and whether they felt pressure to conform their stories to Baquet’s political bias.

Whatever the findings, the publisher must insist that the standards of fairness again become a fundamental tenet in the news room. As an added guarantee, he must insist that the paper enlarge its thinking about diversity to include journalists who disagree with the Times embedded liberal slant. There has to be a difference of perspective to judge where fairness lies.

Readers, and former readers, should be part of the process. Many already know that the paper must get its head out of parochial New York and into the hearts and minds of Americans everywhere.

This is about survival. If it doesn’t change now, the Gray Lady’s days surely are numbered.