The city’s mayoral hopefuls are sharpening their knives — and Anthony Weiner better be ready to answer the hard questions about his sexting scandal.

Sources in the camps of several campaigns said they have been in dirt-digging overdrive ever since the shamed former congressman hinted he was eyeing a mayoral run that would pit him against an already crowded field, including Christine Quinn, Joe Lhota, Bill de Blasio and Bill Thompson.

Potential rivals are aggressively compiling dossiers and detailed lists of questions about the Democrat’s three-year foray into social-media sexting in hope of keeping the illicit Web exchanges at the center of any mayoral bid.

Some contenders are dispatching workers to squeeze Weiner’s online sexting partners — he has claimed there were six in all — for information about the late-night exchanges, which culminated in the infamous “crotch shot” tweet that imploded his career.

“They are taking it very seriously,” a source familiar with the frenzied activity told The Post.

“He is such a danger to them, and he has so much money, that the thinking is, if Weiner wants to run, he has to be destroyed.”

“A lot of questions haven’t been answered about the tweets,” said another source in the campaign of a mayoral candidate.

Among the questions they intend to ask, the source said, are: “What was in them? What did he tell that 16-year-old girl, or 17-year-old girl? He was dealing with someone who was underage?”

“He said he went to rehab,” the source added. “Where was that rehab and how long did he go?”

The former Brooklyn-Queens congressman’s marathon interview with The New York Times Magazine, published online Wednesday, left more questions than answers, another source said.

“Are there more women? I mean, he’s just gotta dump everything,” the source said.

Rival campaigns are also looking at Weiner’s finances, including how he affords the posh $3.3 million Park Avenue South pad he rents from a company headed by deep-pocketed Democratic donor Jack Rosen.

A representative last year told The Post Weiner and his wife, Huma Abedin, are “more than capable” of paying the estimated $12,000 to $14,000 monthly rent.

Weiner’s own confidants have told him to brace for a merciless beatdown — and warned him that more skeletons falling from his closet could kill any chance of a comeback, sources said.

Mayoral contenders sprang into attack mode last Saturday, a source said, after The Post first reported that Weiner was laying the groundwork for a run and that the magazine interview was part of “a two-part process.”

A Democratic strategist working on the mayoral campaign said it appears Weiner knows he would lose but will run anyway.