The Republican Senate primary runoff in Alabama crystallizes how two midterm election themes seem to be at odds: Many Republican voters deeply trust President Trump’s judgment on endorsements, and many are hungry for outsiders.

On Tuesday, voters in Alabama will choose between Representative Barry Moore, who secured the president’s endorsement in January and is running as an unflagging Trump loyalist, and Jared Hudson, a former Navy SEAL and political newcomer running an anti-establishment campaign.

Little about the primary race has gone as expected. The early front-runner, Steve Marshall, the state attorney general, slipped in the polls after Mr. Trump endorsed Mr. Moore. Then, Mr. Marshall missed the runoff altogether, finishing about 15 percentage points behind Mr. Moore and about one point behind Mr. Hudson in the May 19 primary.

Now some polls show Mr. Hudson leading in the runoff, though survey data is limited.

“We may have switched the front-runners three times,” Bill Armistead, a former chair of the Alabama Republican Party, said with a chuckle. “On the one hand, the weight of the president’s endorsement has put Barry Moore where he is,” Mr. Armistead said. But on the other, Mr. Hudson’s outsider pitch has “really caught on with the people of Alabama.”

The election will decide a successor to Senator Tommy Tuberville, a Republican who is vacating his seat to run for governor. Both Senate candidates say they have no significant points of disagreement with the president, and both celebrate his performance during his second term. But Mr. Moore, who has called Mr. Trump the “greatest president in my lifetime,” has particularly deep connections to him.

Mr. Moore, 59, was a state lawmaker in 2015 and endorsed Mr. Trump early during his first run for president, declaring his support at a rally in Mobile, Ala., just two months after Mr. Trump rode down the golden Trump Tower escalator.

Thank you for your patience while we verify access. If you are in Reader mode please exit and log into your Times account, or subscribe for all of The Times.

Thank you for your patience while we verify access.

Already a subscriber? Log in.

Want all of The Times? Subscribe.