The all-rounder, writing in a column for the Daily Mirror, said the tablet had gone down the wrong way and got stuck in his windpipe.
"Until it actually came out, I thought this might be the end," he added. "I was on my own in my room and I couldn't breathe as it became lodged and started to dissolve. It felt like my mouth was on fire.
"Without going into too much detail I have never seen as much saliva as I did on Sunday morning, it was a genuinely frightening experience."
Stokes took an indefinite break from cricket in July to focus on his mental health while also recovering from a second operation on a broken finger, and was a late addition to England's squad for the tour of Australia.
The 30-year-old said the finger injury was coming along really well and that he was in a good place mentally.
However, he was given another scare when he took a ball to his forearm during practice that left him in excruciating pain.
"I couldn't lift it ... I thought it was broken," Stokes added. "Thankfully the pain and reaction settled down once I was back in the dressing room and the physios could be sure it wasn't actually a break.
"It was only after I got back to my hotel room that I took stock of what a day I'd had. The adrenaline had worn off and I was exhausted. Happy that I'm here to tell the tale, but hoping that my pre-test dramas are now over."
The five-test series is due to begin in Brisbane on Dec 8. Australia retained the Ashes in 2019 after a 2-2 draw in England.