Moon Jae-in, the Democratic Party candidate, who surveys project will be the winner, has also vowed to meet Mr. Trump in one of his first acts as president. But he indicated that he would be more confrontational. He has said that instead of avoiding friction with Washington, South Korea should “learn to say no.”

He and many South Korean voters have been outraged by Mr. Trump’s recent suggestion that their country pay $1 billion for a missile-defense battery the United States installed last week. Mr. Moon told a cheering crowd at a campaign rally this week, “Which candidate can do a proud diplomacy, saying what we need to say to the Americans?”

Mr. Moon represents liberal political forces in South Korea who say that under its conservative and pro-American leaders, the country’s alliance has become too “hierarchical” and too “tilted” in Washington’s favor. Liberals have also called for dialogue with North Korea, saying that Mr. Trump was wasting his time if he was waiting for China to enforce United Nations sanctions forcefully enough to stop the North’s nuclear program.

Mr. Moon seeks to bring back a version of the “Sunshine Policy,” under which South Korea promoted dialogue and economic exchanges with the North from 1998 to 2008 to help build trust and lessen Chinese influence on the northern half of the divided peninsula.

Those on the left view the Trump administration’s talk of a “military option” against the North as dangerous. They also do not want their country dragged into a hegemonic struggle between the United States and China, its biggest trade partner.

Mr. Trump’s rough diplomacy could shake a delicate balance in northeast Asia, prompting South Korea to redefine its alliance with Washington and move closer to China, analysts say.