The de Blasio administration tried to stifle the testimony of a whistleblower who says he was fired for calling out corruption at City Hall, The Post has learned.

Ricardo Morales was sacked as deputy commissioner of the Department of Citywide Administrative Services in 2017, claiming in an ensuing lawsuit that it was partly because he cooperated with federal investigators probing the Rivington House controversy.

In that case, the city lifted deed restrictions on the Lower East Side property while it was a not-for-profit nursing home for AIDS patients, paving the way for the seller and subsequent buyer — both repped by a de Blasio donor — to cash in on the site.

The feds ended up dropping their probe into the deal. But the City Council’s Oversight Committee asked Morales to appear before it earlier this month to talk about improving whistleblower protections.

When the mayor caught wind of Morales’s impending testimony, his aides, including Chief of Staff Emma Wolfe, called Council Speaker Corey Johnson (D-Manhattan) and Committee Chair Ritchie Torres (D-Bronx) — and launched a “hysterical overreaction” to the former city worker’s appearance, sources said.

“I think the administration was worried that Ricardo Morales would reveal information about the mayor’s role in Rivington, would air the dirty laundry of the administration,” the source said.

Another source said, “The mayor freaked out to the point where people started to say, ‘Wow, you’re protesting too much.’ ”

Morales’s testimony went forward, anyway — although he didn’t even mention Rivington House.

“The purpose of the hearing was not to re-litigate the issue of Rivington. It was to examine New York City’s whistleblower law,” Torres told The Post.

In his pending lawsuit, Morales includes claims that mayoral aides interceded “on behalf of politically connected donors in order to aid their attempts to gain favorable terms in dealings with the city” and tried to cover up the scandal involving Rivington House nursing home.

He says in the suit that he was fired over the controversy and others.

Out of the 170 cases investigated by the city’s Department of Investigation over five years, only one qualified for whistleblower protection.

A de Blasio spokeswoman noted that it did not involve Morales’s case.

“The hearing was about a serious issue, and it was deserving of a serious conversation,” de Blasio’s press secretary, Freddi Goldstsein, told The Post of the City Council whistleblower hearing.

“We understand that Mr. Morales likes to think of himself as a whistleblower, but that’s just not the case, and we didn’t believe he had any expertise to offer.’’

De Blasio has previously said Morales was fired for “performance’’ issues.