He could have something stuck in his throat, eg sticks bones plastic anything hard to swallow, even dried dog biccys can cause it. Make sure he's got plenty of water when this happens. I'm not sure which method of training you've used, if it's no hands in mouths at all, I would'nt recommend opening it & trying to scoop out anything cz he will very likely bite you as he's not used to it. If you've taught your dog not to bite your hands & accept your fingers in his mouth you can try to scoop. Check in the sides a sweep under the toungue. Don't poke it down the middle as you could push it further down. I've retreived things out this way. Check nothings wrapped around the toungue. I also read on here someones dog ate their underwear! so if there's a bit you can feel in the mouth you could pull it back up. Slowly. They sometimes do this after eating grass too!
I agree w/ above advise, a vet can tell you, what you are describing does sound like kennel cough. When my dog had it he made a hacking sound followed by a pukey sound but did not throw up. So I took him to vet and they diagnosed kennel cough and gave him some pink medicine, antibiotics I believe, that I had to feed him each day and he was better within a week.
My dog would be dead if I had waited to take her to a vet when she was hacking & choking! If there's something blocking the airways in a human you don't wait to take them to a hospital, you do first aid. It pays to check your dog yourself as well. It can come up & back down again or be floating around in their mouth where they can choke on it again if you don't get it out. Hacking will not be be kennel cough if your dogs vaccinated for it like mine is.