The commanding officer of the NYPD’s Highway Patrol Unit was found dead of an apparent self-inflicted gunshot wound Friday afternoon on Long Island, an NYPD spokesman said.

Authorities discovered Insp. Michael Ameri, who has run the unit for nearly two years, in his vehicle parked on Bergen Avenue in West Babylon around 12:42 p.m., police said.

Suffolk County police homicide detectives are investigating the death, authorities said.

The NYPD referred all questions about the probe to Suffolk police.

No other information about the inspector’s apparent suicide was immediately available.

The FBI had questioned Ameri in connection with the police corruption probe, but not in recent days, according to sources familiar with the investigation. The sources said he was not a major focus of the probe.

Ameri was a veteran officer whose death drew condolences from Mayor Bill de Blasio.

advertisement | advertise on newsday

“We are saddened to learn of the passing of Inspector Michael Ameri,” de Blasio said in a statement. “Our thoughts and prayers are with his family during this difficult time.”

Ameri headed the 78th Precinct in Prospect Heights, Brooklyn from 2011 to July 2014 before filling the highway patrol post, according to published reports.

In May 2014, Ameri reportedly ordered patrol cars assigned to the precinct to park parallel to the curb instead of perpendicular to it, an edict stemming from gripes by neighborhood residents — including parents who push strollers along the avenue — that the cruisers took up vital sidewalk space.

Ameri was also credited for another clever tweak in policing that had potential to be adopted citywide when he ordered plainclothes officers to stop drivers who don’t yield to pedestrians in crosswalks, according to a February 2014 report on curbing pedestrian deaths by errant motorists in The New York Times. The result? In one month, officers issued 17 tickets.

With Zachary R. Dowdy and Robert E. Kessler