Donald Trump pulled off a stunning upset victory over Hillary Clinton on Tuesday night, rallying what he called the “forgotten men and women of our country” to win states such as Pennsylvania and Michigan that had not voted for a Republican presidential candidate since 1988.

But Democrats had a simpler answer for why Clinton lost. As one Democratic strategist close to Clinton told The Post, it all came down to “one word: Comey.”

Too bad for Democrats there are zero electoral votes in the State of Denial.

FBI Director James Comey did not use a private email server to conduct official State Department business and put 110 classified emails on that unsecured server.  Comey did not fail to turn over some 14,900 emails to the FBI after assuring Americans that “I turned over everything I was obligated to turn over.” Comey did not lie repeatedly about his emails — first declaring that there was “no classified material” … then that there was nothing “classified at the time” … and then that there was nothing “marked classified” in them.

Comey did not lie to the American people about Benghazi, publicly blaming the attacks on “inflammatory material posted on the Internet” but privately telling the Egyptian prime minister that “we know the attack in Libya had nothing to do with the film.” Comey did not tell Democratic voters that he was against free-trade deals, but then tell Brazilian bankers that his dream was for “hemispheric … open trade and open borders” — or get caught admitting that he has “both a public and a private position” on issues.

Comey did not have a foundation that accepted millions of dollars in donations from foreign governments during his tenure as secretary of state. He did not cut a deal with the Swiss bank UBS AG, which, as I wrote in August, “let tens of thousands of tax-dodging Americans off the hook, while the Clinton Foundation got a cumulative $600,000 in UBS donations and Bill Clinton got $1.5 million for Q&A sessions.” He did not give, as I wrote last month, “special treatment to Clinton Foundation donors after the Haiti quake, asking for them to be identified as ‘FOBs’ (friends of Bill Clinton) or ‘WJC VIPs’ (William Jefferson Clinton VIPs).”

Why did Hillary Clinton lose? Not because of James Comey. She lost because exit polls showed that 54 percent of voters believe that she is “corrupt.” To the elites in Washington, her corruption was apparently no big deal, at least not compared with their horror at the prospect of a Trump presidency. But Americans correctly saw her corruption as corrosive to our democracy and were appalled by the inability of the Washington establishment to see this.

This election was a popular repudiation of Clinton’s corruption and deceit — and she owns that. But there is one person besides herself whom she can blame: President Obama. Because while Hillary Clinton may have lost to Donald Trump, it was Obama who created him.

Three days after his inauguration, when Obama met with congressional leaders to discuss his proposed economic stimulus, Republican leaders gave him a list of modest proposals for the bill. Obama dismissed them, telling the assembled Republicans that “elections have consequences” and “I won.” Backed by the largest congressional majorities in decades, he proceeded to push the largest spending bill in history through Congress with almost entirely Democratic votes.

He later did the same with Obamacare — ramming it though over the objections of the American people and every single Republican in Congress and selling his bill with a series of lies — that Americans could keep their doctors and their health plans and would see premiums decrease by up to $2,500 a year.

This helped produce the tea party revolt that put the House in GOP hands in 2010. Then in 2014, Republicans took control of the Senate. But losing his congressional majorities did not chasten Obama. He did not tack to the center, as Bill Clinton had in 1994. Instead, he doubled down, declaring that he would use his “pen and a phone” to impose his agenda through a raft of executive orders.

When Obama could not pass his Dream Act to provide amnesty for some not here legally, he tried to impose it on the American people though unlawful executive action — only to have it overturned by the Supreme Court. When Congress would not approve his appointments to the National Labor Relations Board (NLRB), he declared the Senate to be in “recess” and appointed them unilaterally (and once again was overruled by the high court). When he could not pass his cap-and-trade bill, he used the Clean Air Act to impose it.  He reached a horrible nuclear deal with Iran and refused to send it to Congress for a straight up-or-down vote.

He also showed contempt for Americans who disagreed with him — dismissing them as “bitter” people who “cling to guns or religion or antipathy toward people who aren’t like them.” Clinton echoed Obama’s contempt, dismissing half of Trump supporters as a “basket of deplorables” who are “racist, sexist, homophobic, xenophobic, Islamophobic” and “irredeemable.”

This contempt, combined with Obama’s imperious efforts to force big-government liberalism on an unwilling nation, created a backlash in the form of Donald J. Trump.  Trump ran against Obama’s signature policies — promising to repeal Obamacare and scrap the Iran deal. Exit polls showed that only 28 percent of Americans wanted to continue Obama’s policies, while 48 percent wanted more conservative policies. And of the 17 percent who wanted more liberal policies, almost a quarter voted for Trump, according to Fox News.

In other words, Trump tapped into dissatisfaction with Obama on both the right and the left. He championed the forgotten Americans whom Obama and Clinton dismissed, and he promised that they “will be forgotten no longer.” They responded by electing him decisively, extending Republican control of both houses of Congress and giving the GOP a net gain of three governorships.

Sorry, Democrats, you can’t blame that on James Comey.