On-the-cusp mayoral candidate Bill Thompson said Wednesday he won’t concede the race for mayor until all the ballots are counted, arguing he has an “obligation” to voters to let the process take its course.

Thompson said Democratic primary leader Bill de Blasio just barely exceeded the 40 percent vote mark needed to avoid a runoff so he wants the paper ballots counted before he’s declared the outright winner.

“If de Blasio is at 39 percent, yes, I will continue,” Thompson said after attending a 9/11 ceremony at The Firemen’s Memorial in Morningside Heights.

“It’s an obligation to the voters, to the process, to make sure every vote … is counted, every voice gets heard and that someone does get to 40 percent.”

The second-place finisher in Tuesday’s Democratic primary, who garnered 26 percent of the votes, estimated there were 16,000 paper ballots to be counted – plenty to keep de Blasio from winning the primary outright.

He said de Blasio exceeded 40 percent in the unofficial voting machine tally by a mere 760 votes of the more than 600,000 cast.

Thompson said he had spoken to two of the other contenders, Council Speaker Christine Quinn, as well as disgraced Congressman Anthony Weiner only briefly late Tuesday.

“I haven’t spoken to them about their support yet,” he said. “We’re going to move into court today – at least court supervision over the ballot-counting process over the next week.”

Thompson, who had sat alongside firefighters’ union president Stephen Cassidy during the ceremony, emphasized that he wasn’t campaigning today because of the 9/11 anniversary. But he took questions from the media for several minutes following the event.

De Blasio, who catapulted from fourth to first place in the crowded democratic mayoral primary, visited The National September 11 Memorial Wednesday morning.

He had no campaign events listed on his schedule and his spokesman declined comment.

A spokeswoman for the Board of Elections couldn’t immediately confirm Thompson’s estimate of the number of paper ballots.

The recount is expected to take at least several days, while a potential runoff would be held October 1.