Doug Mastriano and Kathy Barnette are amplifying Donald Trump’s stolen-election lie in two key races. Republicans fear they could lose in November. Democrats fear they could win.ERIE, Pa. — Republican voters in Pennsylvania, one of the nation’s most hotly contested political battlegrounds, appear to be rallying behind two hard-right candidates for governor and the Senate who are capturing grass-roots anger, railing against the party’s old guard and amplifying Donald Trump’s stolen-election myth.With less than a week until the state’s primary election on Tuesday, polls show that State Senator Doug Mastriano — one of the state’s central figures in the former president’s efforts to overturn the 2020 election — has emerged as the clear front-runner in the G.O.P. race for governor. The candidate for Senate, Kathy Barnette, an underfunded conservative commentator who has never held public office, has made a surprise late surge in the contest that had been dominated by two big-spending rivals, Dr. Mehmet Oz and David McCormick.Mr. Mastriano has made claims of election fraud a central plank of his bid to lead a state that could be decisive in the 2024 presidential race. Ms. Barnette has a history of incendiary remarks, including repeatedly calling former President Barack Obama an adherent of Islam, which she said should be banned, and derisively writing about “the homosexual agenda.” Both candidates have endorsed each other, forging an important alliance.Now, Republicans are concerned about losing both races in November if primary voters embrace such out-of-the-mainstream candidates.Several Republican rivals to Mr. Mastriano have been gathering on private conference calls in recent days in a last-minute attempt to stop him. All agree that he would be a drag on the party, though Mr. Mastriano has yet to sustain any serious coordinated attacks. Two rivals, State Senator Jake Corman and former Representative Lou Barletta, have set a joint event on Thursday, suggesting that the field might soon consolidate, at least slightly.Democrats harbor their own fear: that the bleak 2022 political environment could nonetheless sweep into power Republicans who, in a less hostile climate, might seem unelectable.Kathy Barnette, a Republican candidate for Pennsylvania’s open U.S. Senate seat, at a candidate forum in Newtown, Pa., on Wednesday.Kriston Jae Bethel for The New York Times“Like a lot of Democrats, I’m schizophrenic on this — rooting for the crazy person because it gives us the best chance to win. But at the same time it could give us a crazy senator or a crazy governor, or both,” said Mike Mikus, a Pennsylvania-based Democratic strategist.For years, Pennsylvania has been one of the nation’s quintessential swing states, in which the clearest path to power was through the middle ground between the Democratic and Republican parties. This year’s open seats are because Senator Pat Toomey, a Republican, is retiring and Gov. Tom Wolf, a Democrat, is term-limited.“Pennsylvania is not real good about that extreme on either side,” said Rob Gleason, a former Pennsylvania Republican Party chairman, who was one of Mr. Trump’s chief supporters in the state in 2016 but now worries about Mr. Mastriano in 2022. “No matter what you say, it’s kind of a down-the-middle type of a state.”In Pennsylvania, the governor appoints the secretary of state, the position that oversees state elections, meaning whoever wins the governorship will be overseeing the administration of one of the most coveted swing states in the 2024 presidential race.State Attorney General Josh Shapiro, the presumptive Democratic nominee for Pennsylvania governor, met with environmental advocates in Philadelphia last month.Matt Rourke/Associated PressFor months, the Senate race has been seen chiefly as a heavyweight bout between Dr. Oz, the television personality, and Mr. McCormick, the former chief executive of the world’s largest hedge fund. They and their allies have combined to spend nearly $40 million on television ads. Ms. Barnette, who ran for the House in 2020 in a Philadelphia suburb and lost by nearly 20 percentage points, had rated somewhere between afterthought and asterisk in the race until recently. But a Fox News poll on Tuesday showed the race a virtual three-way tie.To date, Ms. Barnette’s growth has been almost entirely organic, fueled by her sharp debate performances, conservative media appearances and compelling life story, which she told in her book, “Nothing to Lose, Everything to Gain: Being Black and Conservative in America.”A “byproduct of a rape,” as she describes herself, when her mother was only 11, Ms. Barnette talks about growing up “on a pig farm” in Alabama without running water and how her success represents the kind of American dream story that is now at risk.In the final week, Ms. Barnette is receiving some crucial institutional backing: the endorsement of the anti-abortion group Susan B. Anthony List on Tuesday and a $2 million television advertising blitz funded by the Club for Growth, which is broadcasting her up-from-the-bootstraps message statewide.The Club for Growth, one of the biggest spenders in Republican politics, has feuded recently with Mr. Trump after running ads attacking J.D. Vance, the Republican Senate candidate in Ohio, even after Mr. Trump endorsed him. Mr. Vance won that primary, and Mr. Trump has endorsed Dr. Oz in Pennsylvania.Kathy Barnette, second from left, and Mehmet Oz, third from left, with other Republican candidates for Senate last month at a forum in Camp Hill, Pa.Matt Rourke/Associated PressIn some ways, Ms. Barnette’s candidacy is a test of whether the movement that elected Mr. Trump has taken on a life of its own. “MAGA does not belong to President Trump,” Ms. Barnette said in one April debate.Both Dr. Oz and Mr. McCormick have wooed Mr. Trump’s supporters, though it has been an awkward fit. Dr. Oz was booed at a Trump rally, Mr. McCormick was rejected by Mr. Trump, and both have faced questions of carpetbagging in a state where they did not recently live full time.Ms. Barnette has offered herself as an authentic and unfiltered version of what the Republican base wants. “Listen, this time, you do not have to hold your nose and vote for the lesser of two evils,” she said at another debate.She has also made plain that there will be no pivot to the middle if she makes it to the fall campaign.“There’s been a longstanding tradition that we want to get as moderate of a Republican coming out of the primary — someone palatable — for the general,” she said in an interview on Wednesday night at a candidate forum in eastern Pennsylvania. “In doing this, how has that worked out for them? It hasn’t really worked out very well.”In the governor’s race, the presumptive Democratic nominee, Attorney General Josh Shapiro, began running television ads last week featuring a narrator touting Mr. Mastriano’s conservative credentials: “If Mastriano wins, it’s a win for what Donald Trump stands for.” Mr. Trump has not endorsed in that contest.On Tuesday, Mr. Mastriano campaigned in Erie, Pa., with Jenna Ellis, the former co-counsel for the Trump campaign’s effort to overturn the 2020 election.“Doug Mastriano, I like to say, is the Donald Trump of Pennsylvania,” Ms. Ellis said.Mr. Mastriano was a key figure in Mr. Trump’s effort to overturn the results in Pennsylvania, a state he lost by 81,000 votes. As a freshman state senator, he held a hearing in November 2020 featuring Ms. Ellis and the Trump lawyer Rudy Giuliani, visited the White House shortly afterward and remained in close contact with the Trump team. State Senator Doug Mastriano speaking to Trump supporters outside the Pennsylvania State Capitol in Harrisburg a few days after Joseph R. Biden Jr. won the presidential election in 2020.Julio Cortez/Associated PressHe posted an event on Facebook offering bus rides to Washington on Jan. 6, 2021, and his campaign reported spending at least $3,000 chartering buses. But he has claimed that he left before the protest turned violent. In Erie, Mr. Mastriano, whose campaign did not respond to requests for comment, defended the rally.“It’s like, God have mercy on your soul if you dare to go and exercise your First Amendment freedom to go to D.C. on Jan. 6?” Mr. Mastriano said. “You did nothing wrong.”Among those quietly vying to coalesce Republicans around an alternative to Mr. Mastriano is Andy Reilly, one of Pennsylvania’s three Republican National Committee members. Mr. Reilly, who has not endorsed in the race, said the Shapiro campaign’s ads had “raised concerns” and sparked discussions.“The fact that the Democrats are running pro-Mastriano ads tells us that they believe he would be the weakest candidate,” said Charlie Gerow, a longtime Pennsylvania Republican operative who is running for governor and polling in the low single digits.Interviewed while stumping at a bakery in Erie, Mr. Barletta, a former congressman who beat a Democratic incumbent in 2010, called himself the strongest Mastriano alternative.Lou Barletta, a candidate for governor, with his wife and granddaughter last month in Hazleton, Pa.John Haeger/Standard-Speaker, via Associated Press“It’s been myself and Doug Mastriano” at the top of every poll, Mr. Barletta said. “Now people have to make a decision, and a lot of those undecideds need to look at who do they think has a better chance to beat Josh Shapiro.”Bill McSwain, who served as the U.S. attorney for eastern Pennsylvania during the Trump administration, is also running and has spent as much on television as the rest of the field combined, according to AdImpact, a media tracking firm. But he is also the only candidate in the race to be attacked by Mr. Trump. “Do not vote for Bill McSwain, a coward, who let our Country down,” Mr. Trump said last month in a statement attacking Mr. McSwain for not sufficiently pressing Mr. Trump’s false claims of election fraud in Pennsylvania.Mr. Gleason, the former party chairman, is backing Mr. McSwain anyway, fearful that Mr. Mastriano would lose a general election. “He would be toxic,” he said.Representative Brendan Boyle, a Pennsylvania Democrat, said he was approached on the House floor this week by colleagues from other states excited that Republicans could pick two such far-right nominees. But he said that he still remembers 2010, when seemingly unelectable Tea Party Republicans won, and then 2016, when Mr. Trump carried Pennsylvania and the presidency.“I should be happy that Republicans seem to be on the way to blowing both of these races,” Mr. Boyle said. But, he added, “I am very nervous that, lo and behold, two Republican extremists would be elected governor and senator.”For her part, Ms. Barnette, appearing this week on the podcast of Stephen Bannon, the former Trump adviser, dismissed Republican concerns that she was “too MAGA” to win in November.“Do these people have a crystal ball?” she asked. “Are they Jesus incarnate? How do they know?”Tracey Tully More