Both of my kids went through that, although at a younger age. Our pediatrician told us that holding in bowel movements can cause MAJOR problems down the road, and advised us to get the situation under control immediately. He recommended mineral oil - about 2 tablespoons of it in a small glass of orange juice (if the child won't take the oil by itself). Then, stay close by a bathroom, because he WILL have a bowel movement after that! Once he has pooped, then you need to keep him regular using Miralax for a few weeks until he is over the issue of not wanting to go. (Miralax is not a laxative, it simply makes the poop softer so it doesn't hurt to go.) Also, our doctor said to lay off the heavy fiber for a bit, because fiber tends to bulk up the poop, and a child in this situation doesn't need any more bulk in their bowels. He should eat fruits and vegetables, but don't go overboard with fiber supplements or anything. Incidentally, for both of our kids, we found that a sensitivity to dairy foods was causing their constipation problems. We laid off the milk and cheese, and the problem went away long-term.
Anyway, that's what we did, and boy, does mineral oil ever solve this problem! Ask your doctor about it and see if he will approve this for your son. We were told that if the mineral oil did not solve the problem, the next step is an enema, which I thought sounded pretty traumatic for a young child! :(