Mission impossible: accomplished!

The final four young Thai soccer players and their coach were rescued Tuesday from the flooded cave they’d been trapped in for weeks — an incredible ending to the nail-biting rescue mission that gripped the world.

“Today, Thai people, team Thailand, achieved mission impossible,” rescue-operation chief Narongsak Osatanakorn said after the final member of the Wild Boars emerged.

Workers sang and danced at the end of the grueling three-day rescue operation as ambulances whisked the boys away from the cave where they’d been trapped by floodwaters for 18 days since going missing on June 23.

The heroic Thai navy doctor and three SEALs who had been looking after the members of the youth soccer team inside the cave since they were found July 2 also celebrated after emerging.

“All 4 Thai Navy SEALs came out safely,” the unit posted on Facebook alongside a photo of them giving a thumbs-up in wetsuits, surgical masks, climbing gear and sunglasses to block the glare after spending a week in cave darkness.

“Hooyah Hooyah Hooyah,” it added in celebration.

The four men had been staying in the cave with the boys since they were found by divers last Monday, treating the kids and helping them regain strength through food and drink for the dangerous escape dive.

Underscoring how risky the operation was, a former Thai Royal Navy SEAL volunteering in the effort died Friday when he ran out of air while placing tanks along the exit route.

But with monsoon rains threatening to reflood the cave and oxygen levels dropping, rescuers put the plan into motion Sunday, bringing out four boys that day and another four the next. For the third day in a row Tuesday, twosomes of elite divers escorted the boys one at a time through the cave’s submerged chambers and narrow passages.

The kids were all given anti-anxiety drugs to keep them from panicking through the hours-long journey, Thai Prime Minister Prayuth Chan-ocha revealed Tuesday.

“It’s called anxiolytic, something to make them not excited, not stressed,” he told reporters.

Among those rescued Tuesday was Chanin “Titan” Wiboonrungrueng, who at 11 is the youngest and smallest member of the Wild Boars.

Assistant coach Ekkapol Chantawong — a 25-year-old former Buddhist monk who taught the boys to use meditation to get through their harrowing ordeal — also emerged Tuesday. He’d written a letter to the boys’ parents from inside the cave apologizing for the disastrous excursion. They wrote back: “We want you to know that no parents are angry with you at all, so don’t you worry about that.”

On Sunday, rescuers had escorted some of the sickest boys out first.

They included Pipat “Nick” Bodhi, 15, who isn’t even a member of the team but who had tagged along to spend time with his pal, goalie Ekkarat “Bew” Wongsookchan.

Others in the cave included Adul Sam-on — a 14-year-old brainiac whose English-language skills allowed the team to communicate with the British divers who first found them. Adul, a midfielder, is from a poor hill tribe in Myanmar but travels across the border to play soccer and attend school, where he also has learned to speak Thai and Mandarin and play three musical instruments, according to Agence France-Presse.

All the youngsters were rushed to a nearby hospital, where they’re being treated in an isolation ward and are on the mend.

“The kids are footballers, so they have high immune systems,” Thai public-health official Jesada Chokedamrongsuk told reporters Tuesday.

“Everyone is in high spirits and is happy to get out. But we will have a psychiatrist to evaluate them.”

The four who came out Sunday, ages 14 to 16, were suffering from low body temperatures, and two appeared to have lung infections, doctors said.

Their families have finally been able to see them through the ward’s glass window and have chatted with the boys on the phone.

The relatives will be allowed to enter the ward — in sterilized clothing and standing at a distance — if tests show the boys are free of infection, officials said.

The kids are still not allowed to eat the spicy Thai food and KFC they’ve been craving. So far, they’ve had porridge, bread and some chocolate, Jesada said. They will have to remain in the hospital for at least seven days.

With Post Wires