The comments were caught on video during anti-immigration protests outside Wyckoff Heights Medical Center in Brooklyn.
Captain James Wilson was serving as the 94th Precinct executive officer, the precinct's second highest-ranking position, when he made the comments Saturday night.
"He's a temporary, he's expendable, he's temporary, who's Mamdani?" he says on video. "He's total nonsense... he's an embarrassment and total nonsense."
Wilson, 51, also said Mamdani was not his mayor and was heard calling democrats "waste of human race."
He was transferred to the communications division within the 911 call center in the Bronx this week.
All NYPD employees are banned from expressing their personal views about a political party or candidate while on duty.
"That uniform makes you the spokesman for the police department when you say it and there's the issue there," said retired NYPD Chief of Detectives Bob Boyce.
In the video, two other people can also be seen recording Wilson's comments. He is smiling and his own body-worn camera appears to be recording.
"We don't know how it started or how it ended if he tried to walk it back or not," Boyce said.
On Wednesday, Mamdani, a democratic socialist, said he has been hands off with the situation.
"I saw the video, I did not however have any involvement in that decision nor did my city hall," Mamdani said. "My understanding was the decision that was made in accordance with NYPD's administrative guidelines."
Wilson is a 20-year veteran of the department and was only promoted to captain in April. Of three complaints filed against him, one for abuse of authority in 2013 was substantiated by the Civilian Complaint Review Board, but he was cleared after a departmental trial.
The police department's internal disciplinary investigation is underway.
Wilson will remain reassigned to the Communications Center - working alongside civilians - while the departmental investigation plays out, which could take up to a year.
----------
* More Bronx news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Download our connected TV app