A fire lieutenant who headed the FDNY’s recruiting and diversity program was placed on modified duty this month after testing positive for marijuana, The Post has learned.

Daniel Sterling, 39, of Brooklyn, was yanked from his position at an East New York firehouse and placed on modified duty at FDNY headquarters at the Metro Tech Center, sources said

“It came as a surprise to nobody,” an FDNY insider said. “He thought he was above the law.”

Sterling could not be reached, and the FDNY did not immediately respond to a request for comment.

Sources said Sterling vanished from his position several weeks ago before word of the weed bust spread through the department.

He could face further discipline in addition to the indefinite light-duty assignment, sources said.

The department veteran was part of a recruitment team that received an award from the FDNY last year for increasing the ranks of minority firefighters.

The unit is “charged with advancing and supporting initiatives in the recruitment, retention and promotional advancement of men and women of diverse backgrounds in the fire suppression and emergency medical services.”

Diversity has become a hot-button issue at the FDNY, with a federal monitor currently overseeing its recruitment of minorities.

The appointment of former federal prosecutor Mark Cohen was ordered by Brooklyn federal Judge Nicholas Garaufis last year in response to a lawsuit accusing the FDNY of discriminating against minority applicants.

The Post reported this month that Cohen has racked up $3 million in fees and that his tab could top $20 million at the end of his 10-year appointment.

“The city has no viable mechanism to challenge these extraordinary bills, the payment of which must be borne by the taxpayers,” the city’s lawyer, Michael Cardozo, has said.

City officials tried to rein in the spiraling tab last year and accused Cohen of padding the bill with “unnecessary work.”

Garaufis also awarded a black firefighters association $3.7 million to cover its legal costs in a separate discrimination case against the department.