A team of rescuers deployed buoys to keep the mammal from slipping into the water and drowning as veterinarians tended to it. It vomited five plastic bags during the rescue attempt.
The whale died Friday after a five-day fight, the country's Department of Marine and Coastal Resources said, becoming the latest high-profile incident of marine life forced to live in oceans littered with human trash.
An autopsy revealed dozens of plastic bags jamming the whale's stomach, weighing 17 pounds in all, the agency wrote on Facebook.
Photos posted to social media showed so many long black plastic bags that authorities were running out of room to maneuver in the operating room without standing on trash. A bundle of white plastic is shown next to innards stretching across an operating table.
Thai officials said they believe the whale mistook the floating plastic for food. Pilot whales primarily eat squid but are also known to hunt octopus, cuttlefish and small fish when squid prove elusive, the American Cetacean Society said.
Thon Thamrongnawasawat, a marine biologist and lecturer at Kasetsart University in Bangkok, told Agence France-Presse that the plastic probably prevented the whale from digesting food.
“If you have 80 plastic bags in your stomach, you die,” he said, adding that at least 300 marine animals, including pilot whales, sea turtles and dolphins, die annually after ingesting plastic in Thai waters.
More than 5 trillion pieces of trash — and counting — are in the world's oceans, according to a 2014 study. Of that, nearly 270,000 tons of large and small plastic debris are on the surface.
A study published last year found that 83 percent of water samples from more than a dozen nations were contaminated with plastic fibers.
It was unclear whether the whale was a short-finned or long-finned pilot whale, although short-finned pilots commonly traverse the warmer waters typical of Southeast Asia. Males grow up to 20 feet and weigh up to three tons, with females topping out at 16 feet and 1.5 tons, according to the American Cetacean Society.
Trash in the ocean has affected other whale species.
In April, a 33-foot sperm whale weighing more than 14,000 pounds was found dead on a Spanish beach. More than 60 pounds of trash clogged its digestive system.
And in 2016, some of the more than 30 beached sperm whales beached in Europe were found with plastic debris in their stomachs, National Geographic reported, including a large fishing net, an engine cover and shards of a plastic bucket.
Kristine Phillips contributed to this report.