The suspected robber who allegedly held up a Queens T-Mobile store, leading to the death of an NYPD detective, is a career criminal who once was busted for impersonating a cop, lied his way into a Brooklyn court internship and was busted for stalking two judges six years ago.

In 2013, Christopher Ransom was convicted of violating a court order to keep away from a pair of female Brooklyn judges after he lied his way into a judicial internship.

Ransom, 27, was arrested on April 3, 2013, on charges of criminal impersonation, criminal contempt and criminal trespass.

Earlier that year, Ransom pleaded guilty to lying about being a student at Kingsborough Community College to land the internship and sneak into restricted areas of the courthouse, including the judges’ chambers.

He was ultimately slapped with orders of protection to stay away from Brooklyn Supreme Court Judge Patricia DiMango and Judge Ruth Shillingford.

“He was obsessed with the idea of getting into the courthouse without passing the magnetometers,” DiMango testified at his trial, The Post previously reported.

“He would come into my courtroom on various occasions and try to get the attention of the court officers,” DiMango said in testimony at the time, adding, “I said, ‘Maybe I can help you get an internship with another judge,’ and he said, ‘No, I want to do an internship with you.’”

DiMango said she eventually gave in, giving Ransom an internship that allowed him to observe her one morning a week.

Ransom has a total of 25 prior arrests on his record, including one for impersonating a police officer in 2016.

The career crook is accused of robbing a T-Mobile store in Richmond Hill, Queens, Tuesday night using a fake gun.

Of the first two responding officers, 42-year-old Detective Brian Simonsen was killed and Sgt. Matthew Gorman was wounded, both by friendly fire, officials said.