It’s one way to prep for roles.

A man who was busted in Queens with an alleged cache of fake federal-agent IDs played a fed on the FBI-thriller “Quantico” — and was set to appear on the cop drama “Blue Bloods” Tuesday, he told police.

But when cops ran Gregory Smith’s finger prints through the system, they discovered his real-life story is just as action-packed — he escaped from a prison decades ago and has been trying his luck as an actor-on-the-lam, law-enforcement sources said.

“He not only played a federal agent on TV, he acted like one in real life,” one amazed police source told The Post. “When we pulled him over, he was pretty convincing. He spoke the jargon and acted just like a cop.”

Smith, 49, who also goes by the name Hakeem Sessions, was busted with two phony Diplomatic Security Service IDs — worn by counter-terrorism and counterintelligence agents abroad — and a fake NYPD lieutenant’s badge in Jamaica Sunday, law enforcement sources said.

Cops soon discovered he had been arrested in 1998 for drug trafficking and escaped from Davidson Correction Facility in Lexington, North Carolina after just three months behind bars, cops said.

Cops also found his acting business card and a gun, police said.

Smith later told police he had scored work as an extra on several TV shows and had appeared on “Law & Order SVU.”

He griped that he was forced to miss a filming of “Blue Bloods” Tuesday — because he was a real-life slammer, police sources said.

Smith was being held as a fugitive at the Vernon C. Bain correction center in the Bronx Tuesday, according to court papers.

North Carolina cops now want him extradited back to them, police sources said.

Smith is also wanted for a 1988 kidnapping in New Haven, Conn, according to the sources.

As a 17-year-old, he was arrested on a gun possession charge in New York, cops said.

The NYPD’s Strategic Response Group arrested Smith and charged him with impersonating an officer and criminal possession of forged items, weapons and stolen property. He was remanded on a $75,000 cash bond Monday.

Publicists for “Quantico,” “Blue Bloods” and “Law & Order: SVU” didn’t respond to request for comment Tuesday.

Additional reporting by Daniel Prendergast and Shari Logan

Our editors found this article on this site using Google and regenerated it for our readers.