The Alabama race to fill the Senate seat vacated by Attorney General Jeff Sessions pits Mr. Moore, an evangelical favorite, against Luther Strange, who has the support of Mr. Trump and Mitch McConnell, the Senate majority leader. Mr. Strange was appointed to the Senate this year after Mr. Sessions left.

The runoff has put the candidates’ supporters into the tricky position of trying not to offend the other side. Mr. Trump has said he would campaign for Mr. Moore in the general election if he wins. And Breitbart News, the far-right website led by Mr. Bannon, cast Mr. Farage’s visit to Alabama on Monday as an effort to deliver a setback to Mr. McConnell, not the president.

Mr. Trump has wagered his political capital on Mr. Strange, traveling to Alabama on Friday to campaign with him and speak at a rally. Establishment Republicans have told Mr. Trump that Mr. Strange would be a more dependable vote in the Senate than Mr. Moore.

Even with the president’s support, Mr. Strange trails by single digits, and a loss will raise questions about the reach of Mr. Trump’s influence among the Republican Party’s conservative base.

If Mr. Strange succeeds, he will have to defeat a faction of anti-Washington forces aligning with Mr. Moore. In addition to support from Mr. Bannon, Mr. Moore has received endorsements from Sarah Palin, the former Alaska governor, and Phil Robertson, the star of the reality show “Duck Dynasty.”