Democrats are hoping Mr. Lamb’s kitchen-table campaign will show how they can win back the white working-class voters whose disaffection in 2016 cost Mrs. Clinton the White House. And they want to build momentum and voter enthusiasm for the midterm elections in the fall, when they hope to topple Republican control of the House of Representatives.
For their part, Republicans are anxious to secure President Trump’s popularity with his heartland base, break a streak of weak showings in special elections since he took office, and dispel the Democratic narrative of a rising tide of anti-Trump and anti-Republican sentiment among voters. They want the political map to stay the way Mr. Trump recolored it in 2016.
Whether Mr. Lamb wins or loses — polls suggest a dead heat in a district that President Trump won by about 20 percentage points — the lessons from the race will resonate throughout the heartland in November. Democrats will be defending vulnerable Senate seats and trying to pick up House districts and governors’ mansions in Pennsylvania, Ohio and other states where Mrs. Clinton fell short.
Mr. Lamb has been able to make the race close in such a deep-red district in part because of his moderate views on social issues like guns. He insists that he is not running against Mr. Trump. And he agrees with the president on the need for protective tariffs on steel and aluminum.
Mr. Trump himself visited the region on Saturday to champion his 25 percent steel tariff, which is broadly popular here in the crucible of American steel, and also to throw a protective cloak around the embattled Republican in the House race, Rick Saccone.
“Your steel is coming back,” Mr. Trump declared.
In his trademark fashion, he tagged Mr. Lamb with an insulting nickname, Lamb the Sham, and claimed to be better looking than the tall, square-jawed, 33-year-old former Marine and prosecutor.
Mr. Trump predicted that while Mr. Lamb may act like a centrist, he would fall in line behind liberal party leaders in Washington. “For getting your votes, he’s talking about how much he likes tariffs, which is my baby,” the president said.
It is unclear whether voters’ approval of Mr. Trump, which is still strong in the district, will translate into ballots cast for Mr. Saccone, 60, a state representative and former Air Force counterintelligence officer.
Union leaders insisted that many voters in the district would effectively split their tickets, backing the Democratic Party this year even if they had cast ballots for Mr. Trump in 2016.
Organized labor has been losing ground in the American workplace for years, but unions are still politically potent in places like the 18th District, where union carpenters, steelworkers, nurses and other tradespeople and their families account for nearly one in four votes.
It is a district with a minority population of just 7 percent, making unions there a proxy for the white working class. Those voters had been drifting away from the Democrats, a trend that accelerated in 2016, and the party desperately wants to win back their support.
Protectionist tariffs, which most economists warn will hurt more American workers than they help, were a Democratic rallying cry before the era of Bill Clinton. As a candidate, Mr. Trump appropriated the issue, as part of his pledge to restore factories to beleaguered cities. That stance helped pave the way for the narrow victories over Mrs. Clinton in Pennsylvania, Wisconsin and Michigan that won him the White House.
According to internal polling by the A.F.L.-C.I.O., Mrs. Clinton won 10 percent fewer union votes than former President Barack Obama did in 2012.
Many of the voters were indifferent to the Clinton campaign’s attacks on Mr. Trump’s character, which blanketed the airwaves, while he broke through to them with his racially tinged “America First” appeals.
“A lot of our members just didn’t trust Hillary Clinton,” said Tim Waters, the political director of the United Steelworkers. “Donald Trump talked a lot about working-class voter issues, especially on trade. It resonated with a lot of people in working-class neighborhoods. We’re hoping that in 2018, the Democratic Party figures out you can’t have the same message in Phoenix that you have in Pittsburgh.”
Unions have a ready foil in Mr. Saccone, who supports so-called right-to-work legislation in Harrisburg, the state capital, and who opposed requiring the use of American-made materials in public projects. The A.F.L.-C.I.O. said he refused to fill out its candidate questionnaire.
Mr. Saccone, who has served four terms in the Legislature, insisted that his record would not hurt him on Tuesday, because rank-and-file voters were with him on issues like immigration and cutting business taxes and regulations.
“I wouldn’t be in office if union members didn’t support me,” he said in an interview. “They know, while their leadership supports candidates that drive jobs out of Pennsylvania and they’re for sanctuary cities and illegal aliens and open borders, I am against all of that.”
The divide between union leaders and the rank and file is real, in western Pennsylvania and elsewhere. Outside the gates of an Allegheny Technologies steel plant in Washington, Pa., deep in the 18th District, workers coming and going during the changeover to the afternoon shift almost all said they had voted for Mr. Trump.
Most said they still approved of the president’s job performance, and for some, that support extended to Mr. Saccone as well. A number took at face value the flood of TV attack ads that outside Republican groups had been airing, trying to tie Mr. Lamb to Representative Nancy Pelosi, the Democratic leader, whose social positions make her unpopular here.
“If he’s a Nancy Pelosi supporter, I’m not going to vote for him,” Brad Phillips, 45, said.
Mr. Lamb has said repeatedly that he would defy Ms. Pelosi. But a Republican attack ad insists that he, like Ms. Pelosi, favors cuts to Medicare — a hoary accusation based on the Affordable Care Act’s reduction of payments to health providers. (Republicans in Congress retain those same reductions in their bills to repeal the health law.)
Mr. Phillips seemed to cite that attack ad as evidence of Mr. Lamb’s duplicity. “Some of the things she’s supported, he’s backed her,” he said.
Jim Harris, who has worked 31 years at the mill, said he switched his voter registration to Republican a few years ago, and although he is not enthusiastic about Mr. Saccone, he likes Mr. Lamb less. “I can’t go with them Democrats no more,” he said. “They’re against everything I believe in.” Referring to abortion rights and gun control, he said, “They’re against God, they’re killing kids, they want our guns.”
For Kellen Hodge, 60, the Pelosi attack ads also made an impression, but he was skeptical of them because he takes it for granted that all politicians lie. Mr. Lamb appealed to him, he said, because he has never held office before. “I am a Republican, but I probably will vote for Conor Lamb because he is new blood.”
The skeptical attitude some rank-and-file steelworkers have toward Mr. Lamb suggests that Democrats face challenges in winning back white working-class voters they lost in 2016.
John Russo, a retired labor studies professor at Youngstown State University, recently took most Ohio Democrats running in 2018 to task for offering “almost nothing in the way of concrete economic platforms.”
Stanley Greenberg, a Democratic pollster who first identified the phenomenon of Reagan Democrats, was also critical of the party. “Have they put working people at the center of their agenda?” he asked. “Do working people believe Democrats wake up each day worrying about whether those folks are able to get ahead? I think there’s still a long way to go.”
Within the party, there is a boisterous faction that argues that the Democrats’ future lies with college-educated suburbanites and minorities, and that trying to win back white working-class voters may be a lost cause.
One reason Mr. Lamb seems poised to exceed expectations for a Democrat in his district is the anti-Trump fervor of progressive voters concentrated in the white-collar suburbs close to Pittsburgh.
Chuck Moser, a sales director for Cisco who held a fund-raiser for Mr. Lamb at a private club in Sewickley, an affluent suburb, waited in a long line last week to hear former Vice President Joseph R. Biden Jr. campaign for Mr. Lamb.
“I haven’t previously stood out in chilly weather waiting to go to rallies,” he said.
He and his wife, Barb, 40, described themselves as more liberal than Mr. Lamb.
Mr. Moser said voters like them would make an important difference on Tuesday.
“He really does not want to run against Donald Trump in this district,” Mr. Moser said of Mr. Lamb. “He doesn’t mention his name. He doesn’t contrast himself. But what I’m seeing is, a lot of the energy for the Democrats is based upon the dislike of Donald Trump. Even though Conor is not publicly embracing that, he’s definitely benefiting from it.”