G.G.
I have two suggestions. First stop making a big deal about it. He could be feeding off your frustration. Calm down and realize they don't go to school doing it, and so far you say he isn't. Second, when he does have an "accident" try taking away one of his favorite toys, snacks, TV shows, etc. Tell him ahead of time that the next time he "chooses" to go in his pants he will loose "something". Then of course, you need a big reward when he goes in the toilet. I'm a mother of four grnadmother of seven. So I'm speaking from experience.
HTH, G.