Two NYPD detectives were indicted Wednesday for beating a uniformed postal worker in Queens who had just finished his shift, authorities said.

Angelo Pampena, 31, and Robert Carbone, 29, were charged in a five-count indictment, including second-degree assault. Pampena is also charged with second-degree perjury, official misconduct and offering a false instrument for filing for allegedly filing a sworn criminal complaint in court, according to the Queens district attorney’s office.

The postal worker, Karim Baker, had apparently been harassed by police ever since he gave directions to Ismaaiyl Brinsley on the day he shot and killed police officers Wenjian Liu and Rafael Ramos in December 2014.

“Someone just stopped him and said do you know how to get to these houses? Because of that, he’s No. 1 questioned, then harassed and then beaten,” said Baker’s attorney, Herbert Subin. “He was getting pulled over by the cops for no particular reason. It was just generalized harassment.”

But on Oct. 21, 2015, Subin said Baker was “savagely assaulted” by Pampena, who has been an officer for nine years, and Carbone, an officer for eight.

Both have been suspended without pay, an NYPD representative said.

Both were released without bail Wednesday and are expected to come back to court June 27. If convicted, they face up to seven years in prison.

Attorneys for both detectives did not immediately respond to a request for comment.

The two detectives allegedly approached Baker right after he got into his personal vehicle, accusing him of being parked in front of a fire hydrant. While he was sitting, they allegedly punched and kicked him multiple times before dragging him out onto the sidewalk.

Pampena then filed a sworn criminal complaint that said Baker was illegally parked, but video showed that he was more than 15 feet away from the hydrant, according to the DA’s office.

Subin said Baker is planning on suing as well, but appreciates that Queens District Attorney Richard Brown took criminal action.

“I give a lot of credit to DA Brown for holding them accountable,” Subin said. “Hopefully this will put some type of concern into officers feeling like they’re above the law.”

The indictment comes just over a month after video surfaced of cops arresting an on-duty postal worker in Brooklyn.

In that incident, 27-year-old Glenn Grays was placed in cuffs after he said something to plainclothes officers who almost sideswiped him in Crown Heights. He was brought to the precinct and his mail truck was left behind.