Mayor Bill de Blasio’s long-shot run for president may have a defined end date: Oct. 1.

Speaking at an unrelated news conference on Wednesday, Mr. de Blasio said it would be “tough to conceive” continuing his campaign if he does not qualify for the Democratic debate in October.

“I think the logical thing to say is I’m going to go and try and make the October debates and if I can, that’s a good reason to keep going forward,” the mayor said. “If I can’t, I think it’s really tough to conceive of continuing.”

Even before Mr. de Blasio officially entered the race in May, he had met ample skepticism about the validity of his campaign, with his popularity in question even in New York City, where he was first elected mayor in 2013.

That skepticism has grown the longer Mr. de Blasio has stayed in the race, where he has struggled to gain traction in national polls and with donors. His continued candidacy stands in contrast to the decision last week by Senator Kirsten Gillibrand of New York to end her campaign.