He’s Mayor de Blasio’s fall guy.

The only city official fired in the just-concluded federal and state probes into de Blasio says he was axed for one reason — to let other civil servants know that they had better keep their traps shut, or else.

“It was a message to any other deputy commissioner or assistant commissioner that if you step out of line, there will be retribution . . . They made sure I got hit,” said Ricardo Morales, a former deputy commissioner with the Department of Citywide Administrative Services.

“This was a continued level of mendacity that I have never seen in government,” he told The Post.

Though Morales lost his job, de Blasio and his aides are in the clear.

Federal and state prosecutors announced Thursday they were dropping their investigation of political fund-raising by the mayor and his staff.

Morales, 60, who was fired on Feb. 24, said that top City Hall aides turned to him into a pariah after he was grilled by probers last spring.

Staffers with the city Department of Investigation and city comptroller quizzed Morales last March and April about two real-estate transactions that allegedly benefited developers and lobbyists who gave donations to the mayor’s campaign and the mayor’s nonprofit, the Campaign for One New York.

Morales also received a federal subpoena in May.

One of Morales’ projects was the controversial removal of a deed restriction for the Rivington House nursing home on the Lower East Side.

The for-profit nursing home provider — who had bought the Rivington building for $28 million from its former nonprofit operator — claimed it told the city it might convert the property to condos if the city charged them a $16 million fee for modifying the deed. The provider eventually sold Rivington for $116 million, making a $72 million windfall.

The other project involved renegotiating a lease settlement of a Queens restaurant whose owner, a mayoral donor, owed the city $1.8 million in back rent and fines.

“They asked me to answer questions honestly about transactions I had managed and I did,” Morales said.

When asked by The Post whether the mayor knew about the pending deed change, Morales said he did not know because his commissioner handled communications with City Hall on the matter.

After Morales talked to government investigators, he and his lawyer, Guy Oksenhendler, met with the mayor’s lawyers at Carter Ledyard & Milburn.

De Blasio’s lawyers knew Morales had been subpoenaed by the feds. They peppered him with questions to strengthen their defense of the mayor.

“They asked the same questions any interested prosecutor would have wanted to know the answers to,” Oksenhendler said.

After the questioning, Morales noticed a “sea change” in how other city officials treated his office.

“We were constantly trying to justify our work,” he said. “I told our staff, ‘We did nothing wrong. We have to weather the storm.’ ”

Morales joined the DCAS in 2014 after stints as chair of the city Housing Authority and as first deputy comptroller.

Morales’ then-boss, DCAS Commissioner Stacey Cumberbatch, praised his handling of the Rivington House matter.

But after February 2016, when the former nursing home’s owner netted a windfall by selling the building to investors who plan to convert it to condos, the questions began.

Morales said his relationship with senior City Hall aides became strained.

At one May 2016 meeting to prepare DCAS Commissioner Lisette Camilo, who took over after Cumberbatch left, for a City Council hearing, de Blasio aides cut him off, he

recalled.

The mood worsened in July, when the Department of Investigation issued a report that revealed senior officials, including Deputy Mayor Tony Shorris, knew the deed restriction was being lifted before the sale.

Morales’ 22-year career came to an end just hours after feds grilled de Blasio on his fund-raising.

Morales said Camilo and First Deputy Commissioner Emily Newman told him they wanted to reorganize the agency leadership.

On March 1, de Blasio said he “didn’t have anything to do with the timing” of Morales’ firing but “had heard it was coming.”

At a City Council hearing Monday, Camilo called Morales’ firing a “personnel issue” and said it had nothing to do with Rivington.

Others involved in the scandal had softer landings.

Cumberbatch was reassigned to the city’s municipal hospital system in January 2016 with no loss of salary. She has since retired.

“I’m not in the business of revenge,” Morales said. “I’m in the business of protecting my reputation. I want to continue to serve the city.”