Reducing LED PWM Noise: Which is the best option?
Your a) solution is a good one, just make sure the capacitor is as close as possible to the resistor/LED/transistor-branch as possible. Start with a 100nF value and see how that works. If ripple is still too large to your liking, add a electrolytic capacitor in parallel to the 100nF. The 100nF will suppress the higher frequency components and the electrolytic capacitor will do better for lower frequency components.
As @pjc50 says in one of the comments, a gate series resistor as shown in b) is good practice too to avoid ringing. I'd personally pick a lower value, say 100Ω. It will suppress ringing and will avoid the transistor spending too much time in linear mode (=dissipating heat).