NYPD sergeants will be training city cabdrivers on how to protect themselves against violent passengers and farebeaters, as well as teach them methods for handling high-stress situations that could lead to road rage and accidents.

The cabbies and cops also plan to work together to combat offenses ranging from low-level crime to terrorism in a unique partnership between the Sergeants Benevolent Association and the Greater New York Taxi Association that will be announced Wednesday.

“Police officers and taxi drivers are on the streets of New York together all day and night,” said Ethan Gerber, executive director of the GNYTA. “And we want to be the eyes and ears helping the police as much as we can.”

Sergeants will come to taxi garages across the five boroughs to train cabbies using a five- to 10-point safety plan, the two groups say. The cops will also create instructional videos.

Drivers will learn what to do if they see suspicious activity on the street and how to avoid becoming the victim of a crime.

The lessons will also include what to do in the event of a car accident.

The two groups will also push for citywide safety measures aimed at making passengers safer, including requiring all cabs to carry booster seats for children.

The SBA hopes the blue-­yellow alliance will change cops and cabbies’ perceptions of each other.

The two professions have had an adversarial relationship, with cops often thinking of cabbies as reckless drivers who tie up traffic, and foreign-born cabbies harboring a mistrust of cops as a result of police corruption in their native countries.

But both have some of the most dangerous jobs in the city, facing life-threatening situations regularly.

Last month, a rookie cop was shot in Crown Heights, Brooklyn, by a man he stopped for not paying a bus fare.

A cabdriver was beaten into a coma last year in Bedford-Stuyvesant, Brooklyn, by a passenger who refused to pay a fare.

And this month, a cabdriver was pummeled by a sanitation worker in East Harlem. Mamodou Jallow, 41, said the worker hit and yelled at him after they got into a fight over a garbage truck blocking the road.

“We can bridge the gap,” said NYPD Sgt. Ed Mullins, president of the SBA.

Mullins hopes the partnership will make it safer for cops when they pull cabbies over. Language barriers, for instance, can lead to arguments on the roads.

The SBA and GNYTA also hope to boost cop-cabby relations by awarding college scholarships to children of officers and hacks.

“There’s no downside to it,” Mullins said of the partnership. “We can create a friendlier atmosphere.”