Karma or just bad luck? That’s something Berthony Louis will have to figure out either behind bars or while laying in the hospital bed.

The NY Daily News reports:

A 33-year-old thief who tried to swipe an iPhone from a 13-year-old boy fled onto the tracks at a Queens subway station, only to be clipped by a Manhattan-bound express. The goofball move left hundreds of Tuesday morning rush hour commuters stuck in a stifling, powerless train for nearly an hour, cops and witnesses said.

The crook, identified by police sources as Louis, survived a blow to the head from the oncoming F train at 8 a.m., suffering only cuts and bruises to his face, officials said.

He screamed in pain, but quickly fell silent when he realized first responders had shut off the power and begun searching for him, a witness, Patricia Soto, said.

“The police were walking up and down outside the train screaming, ‘Say something or die!’” Soto, 29, said. “But the thief was staying quiet. He didn’t want to get caught.”

Meanwhile, tempers flared on the powered-down train.

“It was getting really hot on the train,” said the Elmhurst resident, whose usual 40-minute commute to Midtown took more than three times as long as the police drama unfolded in the darkened tunnel.

Several hundred other commuters were delayed as trains on the M, R, E and F trains were rerouted from the 65th St. station

“One woman had a panic attack … she was sweating and shaking,” Soto said. “She had to go stand between two cars to get some air.”

Another commuter was screaming that his young son was going to be late for his state Common Core exam.

“We were in there for over an hour,” she said. “It was the worst experience ever. I don’t want that experience again.”

Police and paramedics finally found Louis and brought him above ground to an awaiting ambulance. Dazed and bleeding from the nose, he was shuttled to Elmhurst Hospital for treatment.

Charges were pending Tuesday afternoon.

Police said Louis was on a Manhattan-bound M train between the 65th St. and Northern Blvd. stations in Woodside when he tried to take the iPhone from a teenage straphanger.

As he struggled with the teen, a man and a woman intervened, but Louis fought both of them off — punching the man in the nose, cops said.

When the train stopped at Northern Blvd., he ran out of the train empty handed and jumped onto the track bed, witnesses told police.

The two good Samaritans were also taken to Elmhurst Hospital with minor injuries.