This guy broke the first rule of crook school: Don’t return to the scene of the crime.

A bungling criminal who allegedly shot a security guard at a Target store in Manhattan Sunday got caught after making a clean getaway — when he went back to retrieve his dropped wallet and found authorities waiting for him.

Suspect Christian Vargas’ dumb move came after he had gotten into a scrap with a retired NYPD officer who had been working as a guard outside the under-construction big-box store near East 29th Street and Second Avenue around 5:40 a.m., according to cops.

During the tussle, Vargas, 25, got his hands on the 48-year-old guard’s gun and blasted him in the legs, police said. Vargas then ran off — but somehow managed to drop his wallet.

“That’s why he went back,” said one high-ranking police source of Vargas. “His house key was in his wallet.”

By the time Vargas returned, first responders were already on scene treating the guard, who pointed out his assailant to cops.

Charges against Vargas were pending Sunday, as K9 cops scoured the blocks around the Kips Bay crime scene for the firearm, which Vargas apparently ditched before he was busted.

Investigators were seen overturning trash cans, poking around potted plants and scouring nearby gutters, but the weapon remained unaccounted for late in the evening.

The guard, whose name is being withheld by The Post, was assigned to watch merchandise in the unopened Target until surveillance cameras are installed. He’s in stable condition at Bellevue Hospital.

“We appreciate the quick response from NYPD and will provide them whatever we can to aid in their investigation,” a Target statement read. “Our thoughts today are with the security guard and we wish him a speedy recovery from his injuries.”

The predawn gunplay in the 13th Precinct, one of the city’s safest, shocked locals.

“This is generally a safe neighborhood,” said Jesse Akerman, 70. “I’ve never heard of shootings around here, and I’ve lived here for 38 years.”

The shooting was the first logged this year in the precinct, which saw just one shooting in 2018, NYPD statistics show.

Additional reporting by G.N. Miller, Larry Celona and Sydney Denmark