If he is at all constipated, he will have trouble feeling the signal to go. If you don’t feel a GP trip is warranted, at least consider making sure his diet has him moving well. We added some prunes because dd enjoyed them as a snack anyway.
some children don’t like the feeling of sitting on the toilet, even with a child seat. Are you using that or a plastic child’s potty?
I would actually consider scattering a few plastic potties throughout the house. Make it easier to get to. Then do pants free time on the weekends. Again, easier to get to the potty in time.
Then immediate reward if poo makes it to the correct spot. I know some people do small candies, but with dd who has asd candies did not work, so we had a prize shelf. Just little trinkets. Often taken from birthday party bags or from sets that were broken up. Stickers, a toy car. We started with yay, one poop, then after that was successful for a while, switched it to every other poop, then every 3, etc. I used a chart and when it was full and I printed a new one, it would just happen to have more squares on the row that had to be filled until a prize got earned.
I never did no accidents because failures are going to happen. Reward success and just be matter of fact that accidents happen and move past them.
preschool will be used to the occasional accident. You have 5 months. You will get there.