BRUSSELS (Reuters) - NATO will formally decide on Wednesday to appoint Dutch Prime Minister Mark Rutte as its next boss, as the war in Ukraine rages on its doorstep and uncertainty hangs over the United States' future attitude to the transatlantic alliance.

Ambassadors from NATO's 32 countries are expected to pick Rutte to succeed Jens Stoltenberg of Norway as its secretary-general at a meeting of the North Atlantic Council, the alliance's main decision-making body, according to diplomats.

Rutte's appointment became a formality after his only rival for the post, Romanian President Klaus Iohannis, announced last week that he had quit the race, having failed to gain traction.

Stoltenberg's term ends on Oct. 1. He took office in 2014, just a few months after Russia annexed Crimea from Ukraine.

After declaring his interest in the post last year, Rutte gained early support from key members of the alliance including the United States, Britain, France and Germany.

Others were more reticent, particularly Eastern European countries which argued the post should go to someone from their region for the first time.

But they ultimately rowed in behind Rutte, a fierce critic of Russian President Vladimir Putin and a staunch ally of Ukraine.

NATO takes decisions by consensus so Rutte, who is bowing out of Dutch politics after nearly 14 years as prime minister, could only be confirmed once all 32 alliance members gave him their backing - a process that was completed last week.

Rutte will face the challenge of sustaining allies' support for Ukraine's fight against Russia's invasion while guarding against NATO's being drawn directly into a war with Moscow.

He will also have to contend with the possibility that NATO-sceptic Donald Trump may return to the White House after November's U.S. presidential election.

Trump's possible return has unnerved NATO leaders as the Republican former president called into question U.S. willingness to support other members of the alliance if they were attacked.

(Reporting by Andrew Gray; Editing by Leslie Adler)