“I loved being a legislator,” Ms. Cobb said. “I liked going to the grocery store and hearing people’s stories. To me, that’s why you want a congressperson who lives in your district and shares your values and understands the struggle you are having economically.”

In a telephone interview, Ms. Stefanik countered Ms. Cobb’s narrative, saying that her family has had a home in Willsboro, N.Y., since she was 3 years old. “I have very deep ties to the district,” she said. “I am home almost every weekend. I have had over 750 constituent outreach events.”

Ms. Stefanik, who is a polished debater, having prepared House Speaker Paul D. Ryan for his vice-presidential debate, called her opponent “a desperate candidate who was one of the weakest in the Democratic field,” adding that she “continues to struggle both substantively on very basic issues, but also in terms of fund-raising and getting attention at the national level.”

Ms. Cobb’s campaign did receive some recent national attention, though of the unwelcome variety. Ms. Cobb was talking with teenagers at an event about gun violence in May when she relayed her conversation with a gun-control advocate at an earlier event that day.

On a voice recording made by a teenager who attended the “Teens for Tedra” event, Ms. Cobb is heard recounting her response at the earlier event to a question from a woman named Cindy about assault rifles. “I said they should be banned,” Ms. Cobb says on the recording. Then, she recalls on the tape, after other attendees headed for the buffet, she told the woman, “I want you to know, Cindy, I cannot say that.” The woman responds, “I want you to,” to which Ms. Cobb replies, “I won’t win.”

The National Rifle Association and the Stefanik campaign pounced on the recording, which found its way to the internet, as evidence that Ms. Cobb, who has publicly called for a ban on bump stocks and silencers, but not assault weapons, would push for such a ban if elected to Congress.