A Manhattan federal judge has ruled that a Muslim former member of Mayor Bill de Blasio’s protective detail can continue his lawsuit against the city for failing to promote him, according to documents obtained by The Post.

Detective Abdelim “Abe” Azab filed a $7 million suit against the city last year, claiming he was repeatedly passed over for promotions — and later transferred — because of his faith and because he was born in Egypt.

“Despite receiving consistently high-performance ratings, the plaintiff has not received a promotion since being promoted to second grade detective in 2008; whereas 26 of the 30 EPU detectives, all of whom are non-Muslim and non-Egyptian, have been promoted,” Judge John Koeltl said on Aug. 8, before ruling that part of the suit could go forward.

“The plaintiff alleges four specific instances when non-Muslim and non-Egyptian detectives were promoted ahead of him, even though each had between three and six years of less time in rank than the plaintiff had when they were promoted.”

Azab’s attorney Marshall Bellovin lauded the decision.

“The judge got it right,” said Bellovin, who is representing other ex-EPU detectives who have filed similar suits against the city. “He denied the City’s attempt to prematurely dismiss this case, and permitted us to go forward, as did three other federal judges who agreed that each of my other clients, who are all former EPU detectives, should have their day in court.”

“Judge Koeltl was on-target when he pointed out that Detective Azab’s ‘complaint is really about failure to promote,'” he added.

While he ruled partially in Azab’s favor, Koeltl also tossed part of the lawsuit, throwing out claims of a hostile work environment.

The city Law Department did not immediately respond to a request for comment.