A violent thief wanted for a $150,000 Manhattan robbery was collared at an Upper West Side hotel after a crafty detective tricked him into returning to his room to retrieve his forgotten gun, law-enforcement sources said.

Ajamu White, 38, allegedly stuck up NYC Check Express on Aug. 7, pointing a gun at a staffer’s forehead and threatening to shoot if he didn’t get what he wanted.

The ex-con then handcuffed two female employees and fled with cash and MetroCards from a safe, according to a criminal complaint against him.

“I was traumatized,” said one of the women whom the suspect handcuffed. “I’m glad he was caught.”

White later checked into the Days Hotel on West 94th Street, cops said. A maid cleaning his room on Sept. 3 found a loaded 9mm handgun, and cops were called.

An NYPD detective then impersonated a hotel security guard and told White — who claimed to be a federal agent — that cops would be called if he didn’t come back and get his weapon, sources said.

When the gunman rushed back, waiting cops arrested him in the lobby, and found the stolen MetroCards along with fake mustaches in the suspect’s bag.