Representative Andy Ogles, Republican of Tennessee, faces a more competitive race than expected in the state’s primary election on Thursday, after a last-minute influx of outside political spending and a surprise endorsement for his rival.
Mr. Ogles, a two-term congressman, has President Trump’s endorsement but also carries some political baggage. He has been criticized for inflammatory anti-Muslim and anti-immigrant comments, and investigated for campaign finance issues.
Charlie Hatcher, a former state commissioner of agriculture and Mr. Ogles’s primary challenger, was endorsed on Tuesday by Bill Lee, Tennessee’s outgoing Republican governor and a longtime friend.
“Charlie has stood with President Trump since Day 1,” Mr. Lee said in a video he posted on social media.
The late endorsement could give Mr. Hatcher an additional boost on Election Day, though the governor’s support came after thousands of Tennessee Republicans had already cast their ballots in early voting.
“As farmers and businessmen, we both understand the value of hard work, responsible leadership and getting the job done,” Mr. Hatcher said in a statement. “In Congress, I will work hard, serve people and get the job done by pursuing sensible, problem-solving solutions.”
Mr. Hatcher, a dairy farmer, also received a lift from $2 million in spending since mid-July from the Invest in Tomorrow Coalition, a super PAC funded by renewable energy developers. It sees Mr. Ogles as vulnerable in the primary, given his lackluster fund-raising and redrawn district, which has required him to introduce himself to new voters.
Thomas Matzzie, who leads the super PAC, acknowledged that if Mr. Ogles were to lose in the primary, Democrats might have a harder time in their long-shot bid to flip the seat in the general election. The winner of the Republican primary is expected to face Mayor Chaz Molder of Columbia, Tenn., the leading Democratic candidate.
Mr. Matzzie, a renewable energy executive who worked for more than a decade on Democratic campaigns, said his organization wanted to make an example of Mr. Ogles and send a message to other Republicans it saw as particularly hostile toward renewable energy.
Mr. Ogles has accused the industry of trying to “buy” a congressional seat. “At the end of the day, I voted for conservative policies, and that’s what America wants right now,” he said.
The Fifth Congressional District of Tennessee had been a Democratic stronghold centered on Nashville for more than a century, until the 2020 census. The Republican supermajority in the General Assembly carved up the city and paired it with more conservative rural areas, paving the way for Mr. Ogles to win his first term in 2022.
Two years ago, he defeated a challenger, backed by more centrist Republicans, in a closely watched primary. Mr. Trump won the district with about 61 percent of the vote in 2024.
In May, after the Supreme Court weakened the Voting Rights Act of 1965, Republicans again changed the district lines to move just outside Nashville and include pieces of Memphis, as part of an effort to dilute the state’s lone majority-Black district. The move made the seat more conservative and safe for Mr. Ogles — and carved both Mr. Hatcher and Mr. Molder out of the district.
But Mr. Ogles, 55, has continued to be a magnet for scrutiny and controversy.
On Wednesday, he shared a video clip on social media of his conversation with the right-wing podcaster Benny Johnson, which included more anti-Muslim remarks.
Irineo Cabreros contributed reporting.