Brain mapping is really complex but we're gradually making headway. A while back, I heard a TED talk about optimism and the thing is that they were able to make people more optimistic or pessimistic by interfering with very specific areas of the brain (More info). In order to do this, your dystopian government would need to map out every part of your brain that had corresponding emotions (which, as a someone who approaches psychology from a biological psychologist, should be possible) and then custom tailor bacteria strains to cut away a target's emotions, targeting these specific centers and unleash them on small children who are just beginning to emotionally develop.\
Why this approach specifically when another solution is to just mildly drug everyone with depressants? Well, this gives your protagonist the ability to resist it because he has rare immunity to this gene-altering bacteria they use.
Shutting down pain is even easier, as you just have these bacteria target the genes which create pain receptors, but it's incredibly stupid. Pain's a pretty useful tool when it comes to human self-preservation, and even a dystopia doesn't want to kill it's citizens without a reason to do so.