The rookie cop who was hacked in the head by a hatchet-swinging terrorist left a Queens hospital Wednesday as hundreds of fellow officers cheered him on.

Wrapped in bandages, Kenneth Healey, 25, of Oceanside, LI, smiled and waved at Jamaica Hospital before climbing into an ambulance bound for a rehab center.

“It’s a miracle. The kid has a strong personality that will help him fight through the pain,” said Pat Lynch, president of the New York City Patrolmen’s Benevolent Association.

“He’s talking, he’s eating and he’s coming along,” he said.

Healey was moved to North Shore Hospital in Manhasset, where he faces weeks of physical therapy but is expected to recover, said Healey’s uncle, Patrick Shea, 48, a former NYPD detective.

“It’s been a roller coaster,” Shea said. “We didn’t know if he was going to survive in the beginning.”

Now, the uncle said, “I’m sure he’s going to make a full recovery. That’s his goal, to go back to work.”

Healey and three other cops were attacked by Muslim extremist Zale Thompson, 32, on Oct.23.

After the madman chopped the back of Healey’s head with a hatchet, he was shot dead. Of the wounded cops, Healey’s injuries were the most serious.

On Wednesday, a police bagpipe band played as Healey stepped out of his wheelchair and into an ambulance on his own.