A Bronx cabby was shot in the hand last night as he tried to wrest a gun from a teenage thug putting the weapon to his head, cops said.

The livery driver, identified only as a 41-year-old Bronx man, took a bullet through his right hand as he desperately held on to a gun aimed at his head while swerving his Town Car through traffic.

He had been sent to pick up two teens, believed to be about 15 years old, at 6 p.m. near Third Avenue and Crotona Park South.

As he pulled away with his passengers, he grew suspicious when they couldn’t say where they wanted to go and he told them to get out.

But before he could stop, one of the teens put a gun to his right temple and demanded money.

The driver grabbed the gun.

“The kid was screaming, ‘Let the gun go!’ – but the driver was swerving and yelling back, ‘I’m not getting shot!’ ” according to Federation of Taxi Drivers President Fernando Mateo, who spoke to the victim at the hospital.

As they struggled, the cab was rear-ended by a car and the gun went off, sending a bullet through his hand.

The car hit a curb and stopped and the teens jumped out. They were still being sought last night.

The 16-year veteran driver was in stable condition at Lincoln Hospital.