The feeling is familiar. I had it four years ago and four years before that: a sinking feeling in the stomach. It's a kind of physical pessimism which says: "It's happening again. The Democrats are about to lose an election they should win - and it could not matter more."

In my head, I'm not as anxious for Barack Obama's chances as I was for John Kerry's in 2004 or Al Gore's in 2000. He is a better candidate than both put together, and all the empirical evidence says this year favours Democrats more than any since 1976. But still, I can't shake off the gloom.

Look at yesterday's opinion polls, which have John McCain either in a dead heat with Obama or narrowly ahead. Given the well-documented tendency of African-American candidates to perform better in polls than in elections - thanks to people who say they will vote for a black man but don't - this suggests Obama is now trailing badly. More troubling was the ABC News-Washington Post survey which found McCain ahead among white women by 53% to 41%. Two weeks ago, Obama had a 15% lead among women. There is only one explanation for that turnaround, and it was not McCain's tranquilliser of a convention speech: Obama's lead has been crushed by the Palin bounce.

So you can understand my pessimism. But it's now combined with a rising frustration. I watch as the Democrats stumble, uncertain how to take on Sarah Palin. Fight too hard, and the Republican machine, echoed by the ditto-heads in the conservative commentariat on talk radio and cable TV, will brand Democrats sexist, elitist snobs, patronising a small-town woman. Do nothing, and Palin's rise will continue unchecked, her novelty making even Obama look stale, her star power energising and motivating the Republican base.

So somehow Palin slips out of reach, no revelation - no matter how jaw-dropping or career-ending were it applied to a normal candidate - doing sufficient damage to slow her apparent march to power, dragging the charisma-deprived McCain behind her.

We know one of Palin's first acts as mayor of tiny Wasilla, Alaska was to ask the librarian the procedure for banning books. Oh, but that was a "rhetorical" question, says the McCain-Palin campaign. We know Palin is not telling the truth when she says she was against the notorious $400m "Bridge to Nowhere" project in Alaska - in fact, she campaigned for it - but she keeps repeating the claim anyway. She denounces the dipping of snouts in the Washington trough - but hired costly lobbyists to make sure Alaska got a bigger helping of federal dollars than any other state.

She claims to be a fiscal conservative, but left Wasilla saddled with debts it had never had before. She even seems to have claimed "per diem" allowances - taxpayers' money meant for out-of-town travel - when she was staying in her own house.

Yet somehow none of this is yet leaving a dent. The result is that a politician who conservative blogger Andrew Sullivan calls a "Christianist" - seeking to politicise Christianity the way Islamists politicise Islam - could soon be a heartbeat away from the presidency. Remember, this is a woman who once addressed a church congregation, saying of her work as governor - transport, policing and education - "really all of that stuff doesn't do any good if the people of Alaska's heart isn't right with God".

If Sarah Palin defies the conventional wisdom that says elections are determined by the top of the ticket, and somehow wins this for McCain, what will be the reaction? Yes, blue-state America will go into mourning once again, feeling estranged in its own country. A generation of young Americans - who back Obama in big numbers - will turn cynical, concluding that politics doesn't work after all. And, most depressing, many African-Americans will decide that if even Barack Obama - with all his conspicuous gifts - could not win, then no black man can ever be elected president.

But what of the rest of the world? This is the reaction I fear most. For Obama has stirred an excitement around the globe unmatched by any American politician in living memory. Polling in Germany, France, Britain and Russia shows that Obama would win by whopping majorities, with the pattern repeated in Africa, Asia, the Middle East and Latin America. If November 4 were a global ballot, Obama would win it handsomely. If the free world could choose its leader, it would be Barack Obama.

The crowd of 200,000 that rallied to hear him in Berlin in July did so not only because of his charisma, but also because they know he, like the majority of the world's population, opposed the Iraq war. McCain supported it, peddling the lie that Saddam was linked to 9/11. Non-Americans sense that Obama will not ride roughshod over the international system but will treat alliances and global institutions seriously: McCain wants to bypass the United Nations in favour of a US-friendly League of Democracies. McCain might talk a good game on climate change, but a repeated floor chant at the Republican convention was "Drill, baby, drill!", as if the solution to global warming were not a radical rethink of the US's entire energy system but more offshore oil rigs.

If Americans choose McCain, they will be turning their back on the rest of the world, choosing to show us four more years of the Bush-Cheney finger. And I predict a deeply unpleasant shift.

Until now, anti-Americanism has been exaggerated and much misunderstood: outside a leftist hardcore, it has mostly been anti-Bushism, opposition to this specific administration. But if McCain wins in November, that might well change. Suddenly Europeans and others will conclude that their dispute is with not only one ruling clique, but Americans themselves. For it will have been the American people, not the politicians, who will have passed up a once-in-a-generation chance for a fresh start - a fresh start the world is yearning for.

And the manner of that decision will matter, too. If it is deemed to have been about race - that Obama was rejected because of his colour - the world's verdict will be harsh. In that circumstance, Slate's Jacob Weisberg wrote recently, international opinion would conclude that "the United States had its day, but in the end couldn't put its own self-interest ahead of its crazy irrationality over race".

Even if it's not ethnic prejudice, but some other aspect of the culture wars, that proves decisive, the point still holds. For America to make a decision as grave as this one - while the planet boils and with the US fighting two wars - on the trivial basis that a hockey mom is likable and seems down to earth, would be to convey a lack of seriousness, a fleeing from reality, that does indeed suggest a nation in, to quote Weisberg, "historical decline". Let's not forget, McCain's campaign manager boasts that this election is "not about the issues."

Of course I know that even to mention Obama's support around the world is to hurt him. Incredibly, that large Berlin crowd damaged Obama at home, branding him the "candidate of Europe" and making him seem less of a patriotic American. But what does that say about today's America, that the world's esteem is now unwanted? If Americans reject Obama, they will be sending the clearest possible message to the rest of us - and, make no mistake, we shall hear it.

· freedland@theguardian.com