Representative Dean Phillips of Minnesota, a Democrat running a long-shot primary challenge to President Biden, said on Saturday that he would consider running on the ticket of No Labels, a centrist group exploring an independent bid, if it appeared the general election would be a rematch between Mr. Biden and Donald J. Trump.

In an interview, Mr. Phillips publicly articulated for the first time the circumstances in which he would accept the No Labels presidential nomination, and said he was in regular communication with Nancy Jacobson, the group’s chief executive. Democratic allies of Mr. Biden have been alarmed by No Labels, worrying that any candidate it runs could siphon votes from him.

“People are criticizing them because they believe whomever they offer on their ticket will hurt Joe Biden,” Mr. Phillips said after a town-hall event at a senior center in Nashua, N.H. “That’s false. If they put someone at the top of the ticket who could actually drive votes from Donald Trump, every Democrat in the United States of America should be celebrating it. They haven’t made that determination.

Mr. Phillips has a long relationship with Ms. Jacobson and No Labels from his tenure in the group’s congressional Problem Solvers Caucus, an organization that promotes policies with bipartisan support. He said he had told Ms. Jacobson he would not discuss running as the No Labels candidate “at this time.”

But Mr. Phillips did say he would consider running as the No Labels candidate if polling suggested that Mr. Biden would lose in November to Mr. Trump.

“It would have to be a Joe Biden-Donald Trump rematch that shows Joe Biden is almost certain to lose,” Mr. Phillips said. “That is the only condition in which I would even entertain a conversation with any alternative.”

He added, “Everybody should keep their head and heart and mind open, because why would we shut off possibilities to defeat this horrific danger to democracy?”

Three months after beginning his presidential campaign, Mr. Phillips remains a little-known curiosity in the New Hampshire primary race. A poll released on Jan. 9 by the University of New Hampshire showed him with 7 percent support in the Democratic primary. He told reporters on Saturday he would be happy with “mid-twenties” support in the election on Tuesday.

Mr. Phillips has spent millions of dollars of his own money on his bid, and his TV ads are ubiquitous on New Hampshire television, but it’s not clear how much support he has.

New Hampshire voters at his Saturday event in Nashua were vastly outnumbered by out-of-state college students, political tourists and journalists. It is also atypical for presidential candidates to publicly float running as a third-party or independent candidate while still competing in a major party’s primary race.

Mr. Trump, at his own rally on Saturday night in Manchester, N.H., offered a mocking endorsement of Mr. Phillips. “Democrats should vote for the congressman,” he said.

Mr. Biden’s name will not be on the primary ballot in New Hampshire. His campaign declined to participate after the state refused to cooperate with his shake-up of the Democratic presidential nominating calendar, which moved South Carolina to the first spot.

A well-funded group of Biden loyalists has mounted its own campaign in New Hampshire, encouraging Democrats to write in Mr. Biden’s name on the ballot on Tuesday.

Groups of Democrats allied with the Biden campaign have been working in concert for months to scuttle Ms. Jacobson’s aspirations to offer an alternative presidential candidate in November. They fear that any vote for a third-party or independent presidential candidate will take votes away from Mr. Biden, given his campaign’s focus on making the 2024 election a referendum on Mr. Trump’s fitness for office.

Ms. Jacobson has tried to recruit Senator Joe Manchin III of West Virginia and former Gov. Larry Hogan of Maryland, among others, in an attempt to find a high-profile figure to lead the No Labels presidential ticket. Ms. Jacobson has told donors privately that the group plans to choose a Republican as its presidential nominee. Mr. Hogan — who until recently was a member of the No Labels board — has said so publicly.

A spokesman for the Biden campaign declined to discuss Mr. Phillips.

Ms. Jacobson said Saturday that it was “too early to speculate” on whom No Labels might select as its standard-bearer or if the group would follow through on its plans to run a presidential candidate.

“Dean Phillips is a terrific member of the Problem Solvers Caucus,” she said. “He embodies the ethos of the No Labels movement.”

In the interview, Mr. Phillips said repeatedly that he was “not ruling anything out” and denounced absolutist language from other politicians.

“No Labels can either be the goat or the hero,” he said. “I will also do what I can to ensure that they’re the latter.”