A former FedEx driver plans to sue the city for $10 million after he was allegedly beaten to a pulp by cops furious over the fact that he unwittingly gave directions to the gunman who assassinated two cops last year, his lawyer said Tuesday.

Karim Baker, 26, of Corona, Queens, says he was stopped for minor traffic infractions about 20 times by cops who wrongly blamed him for his accidental role in the execution-style slayings of Rafael Ramos and Wenjian Liu last year, said his lawyer, Eric Subin.

When Baker finally objected to being questioned outside his car during yet another stop Oct. 20, two undercover cops slammed him to the ground, the lawyer said. They then allegedly delivered a “savage beating” before slapping him with trumped-up charges of resisting arrest, obstruction and parking too close to a fire hydrant.

“It is a particularly bizarre set of facts,” Subin said.

“I cannot really fathom a circumstance where a guy is pulled over 20 times in the span of nine months, never been given a ticket, and then on the heels of that, they beat the hell out of him and put him in the hospital.”

Baker had just finished delivering a package in the Bedford-Stuyvesant section of Brooklyn on Dec. 20, 2014, when cop-hater Ismaaiyl Brinsley approached him and asked how to get to the Marcy Houses project, Subin said.

A short time later, Brinsley snuck up on Ramos and Liu as they sat in a marked NYPD cruiser and opened fire without warning, killing them both.

Brinsley then ran to a nearby subway station, where he shot himself to death as cops closed in.

During the NYPD’s investigation of the double cop killing, detectives uncovered surveillance footage that showed Baker and Brinsley’s brief interaction, Subin said.

Cops spent several weeks staking out Baker and barraging him, his relatives, his co-workers and boss with “question after question” about his contact with Brinsley, Subin said.

Then, early this year, Baker started getting pulled over, but never charged, “for the lowest traffic violations imaginable,” such as changing lanes without signaling or not coming to a complete stop at a stop sign, Subin said.

In addition to the physical injuries, Subin said Baker — whom he called a “remarkably upstanding citizen” with no criminal record — was emotionally traumatized by his beating.

“The guy can barely get through a sentence without breaking down in tears,” Subin said.

An NYPD spokesman said Baker’s claims were “under review, “ adding: “We dispute the allegations and have no information to corroborate these allegations.”

Additional reporting by Shawn Cohen