A city investigation into the social media activity of a top education official busted for trying to have sex with a 14-year-old was among the probes allegedly shelved to avoid bad press during Mayor Bill de Blasio’s failed presidential campaign, The Post has learned.

David Hay, schools Chancellor Richard Carranza’s ex-deputy chief of staff, frequently used Twitter to boost his boss — and sometimes bully critics, complainants told the Special Commissioner of Investigation for city schools last summer.

Yet the probe into the online activity of Hay — arrested late last month and charged Friday in Wisconsin with sex crimes against children — was one of nine allegedly blocked cases, according to an Aug. 20 whistleblower letter sent to three city councilmen.

One of the three, Councilman Robert Holden (D-Queens) urged the SCI and Conflicts of Interest Board to look into the complaints against Hay and other Department of Education employees.

“The fact that they didn’t do a complete background check or check his social media is outrageous,” Holden said, referring also to the city’s admission that it failed to fully vet Hay when he was hired in 2016. He pulled down $168,000 last year.

On Twitter, Hay was a cheerleader for Carranza, and needled the chancellor’s critics.

“Before you embark on a journey of revenge, dig two graves,” he tweeted July 7 to @CocoAmore1.

In another tweet described as intimidating to DOE employees, Hay posted an essay by an Indianapolis teacher, “The Discomfort of White Adults Should Never Take Priority Over the Success of Our Black and Brown Students.”

After The Post questioned the tweets, Hay removed his job title from his Twitter profile, but still cited his DOE connection, calling himself a “Proud Educator, Excellence through Equity @nycschools.”

On Saturday, Hay’s Twitter page was yanked, with a notice saying it “doesn’t exist.”

The removal came after Hay was released Friday from a Wisconsin jail on “home detention” at his mother’s house in that state, authorities said.

Hay booked a “Whirlpool Suite” at Best Western for Dec. 28, when he allegedly planned to have sex with a boy he believed to be 14 years old, but who was an undercover cop, according to a criminal complaint filed by the US Attorney for the Eastern District of Wisconsin.

After graphic exchanges about the size of their genitals and the acts they would perform, Hay backed out at the last minute, saying his mom was injured in a fall and “our age diff” court papers allege.

Authorities obtained a search warrant on his smartphone and discovered sexually explicit photos of a former student from one of two Wisconsin high schools where Hay had served as principal before joining the DOE.

A DOE spokeswoman would not say whether the phone was issued by the agency.

The stalled SCI cases included complaints about the mayor, First Lady Chirlane McCray, Carranza and other “top-level executives.”

The whistleblowers also accused the SCI of stalling a probe of City Hall interference in the DOE’s long-running yeshiva investigation. The SCI and DOI have since reported that City Hall interfered with the probe to protect de Blasio’s bid in Albany for mayoral control of schools.

An SCI spokeswoman did not return a request for comment last week.