He tried to catch the train, but the train caught him — and nearly took him on his last ride ever.

Jonathan Lynn says he was forced to break his own arm to escape the clutches of a Brooklyn subway car that was dragging him to nearly certain death.

Lynn’s April 2010 nightmare ride began when he dashed to catch a G train at the Classon Avenue station and the closing doors trapped his shoulder while the rest of his body was still on the platform, according to a Brooklyn Supreme Court lawsuit.

The train began to move, pulling him relentlessly toward the tunnel.

“I didn’t think it was real,” said Lynn, a 32-year-old Web developer from upstate Sloatsburg. “I thought, ‘He’s going to open the doors.’ ”

Lynn had walked down to the platform to find a train already there and the operator waving him aboard, the suit says.

It was stopped one car length from the end of the platform, and the doors to the first car were closed, so he jogged to the second and began to board when the doors slammed shut.

As Lynn struggled to free his arm and carrier bag the train began to move. There was no one in the car to help.

He ran along with the car, yelling and pounding on the door, unable to get the operator’s attention as he was dragged toward the wall, according to the suit, which names the MTA and two of its employees.

“That wall approaching gave me the final push,” he said. “With all of my might, I yanked and pushed.”

He managed to free his arm and bag, but the momentum sent him flying.

“I bounced off one of the pillars,” he said.

Lynn suffered a compound fracture and a gaping wound to his left arm as well as a head injury, according to the suit, which seeks unspecified damages.

“My client basically had to save his own life, and to do that he had to break his own arm,” said Lynn’s lawyer, Duncan Peterson.

An MTA spokesman said the agency does not comment on pending litigation.