The first-in-the-nation primary could be the last stand for the anti-Trump Republican.

Since 2016, a shrinking band of Republican strategists, retired lawmakers and donors has tried to oust Donald J. Trump from his commanding position in the party. And again and again, through one Capitol riot, two impeachments, three presidential elections and four criminal indictments, they have failed to gain traction with its voters.

Now, after years of legal, cultural and political crises that upended American norms and expectations, what could be the final battle of the anti-Trump Republicans won’t be waged in Congress or the courts, but in the packed ski lodges and snowy town halls of a state of 1.4 million residents.

Ahead of New Hampshire’s primary on Tuesday, the old guard of the G.O.P. has rallied around Nikki Haley, viewing her bid as its last, best chance to finally pry the former president from atop its party. Anything but a very close finish for her in the state, where moderate, independent voters make up 40 percent of the electorate, would send Mr. Trump on an all-but-unstoppable march to the nomination.

The Trump opposition is outnumbered and underemployed. The former president’s polarizing style and hard-nosed tactics have pushed many Republicans who oppose him into early retirement and humiliating defeats, or out of the party completely. Yet, their long-running war against him has helped to frame the nominating contest around a central, and deeply tribal, litmus test: loyalty to Mr. Trump.

Gordon J. Humphrey, a former New Hampshire senator, was a conservative power broker during the Reagan era but left the party after Mr. Trump won the presidential nomination in 2016. This year, he has produced anti-Trump Facebook videos aimed at encouraging college students and independent voters who, polls show, are more likely to support Ms. Haley over Mr. Trump.

“It’s very big stakes,” Mr. Humphrey, 83, said. “If he wins here, Trump will be unstoppable.”

Campaigning across the state this week for Ms. Haley, Gov. Chris Sununu of New Hampshire, a moderate Republican, argued that the man who remade the party in his image is not its best standard-bearer.