C.Y.
My son has the same issue. He was potty trained right after he turned 3. His preschool teacher told me that he poops on the potty at school. However, he would only poop in diaper while at home. We tried everything and nothing worked. It has been this way for about nine months. Finally, we followed his teacher advice to buy him a toy that he likes (a lot) and make him earned it for pooping on the potty for a number of times (we did 10) and it worked. Once we established the number of times he had to poop on the potty, my husband was firmed about sticking to it. Also, your son might be more incline to do it once he sees other kids do it at school. The peer pressure works magic.
Good luck!
C.