We struggled with our daughter getting her to be okay with pooping on the potty - she wouldn't poop her pants, but she was afraid of going on the potty so she would just hold it in. She would get constipated, it would hurt, we would have to put her on stool softeners, she would still be afraid of going poop because it would hurt, etc. - the whole vicious cycle.
What our pediatrician recommended was getting her in the habit of sitting on the potty for 10 minutes twice a day, after eating (breakfast and dinner). Even if she was insisting she didn't have to go, still making her do it. Her incentive to stay put was she got to play games on my phone while she sat and waited, but it had to be 10 minutes (unless she happened to go before the 10 minutes was up - then she was able to get up and play on the phone another 30 minutes or so). It got her used to regularly trying to poop, sitting there for a while to give it a chance to come out, getting it into the toilet, getting over her fear, and giving her rewards for trying +/- succeeding. It really worked well for her and now at 5, we don't have an issue and I don't really worry about it - I don't see a poop at home every day but she says she goes at school fairly often (and thank goodness we have not had an issue as far as not wanting to go anywhere but home!).
I would try something like that, and then also have some kind of big reward (i.e. trip to arcade, special toy, etc. - whatever his "currency" is) for when he meets a big goal - for example, 10 poops in the potty with no accidents, or poops in the potty for a solid month and no accidents. I would also remind him of what kids who poop their pants DON'T get to do - like swim in a pool!