Normally I add 5.2 to the mash.. this dry stout recipe calls for gypsum at some point.
Should I use 5.2 like normal in the mash, and add the gypsum to the boil?
Stouts and other dark ales would normally use calcium carbonate rather than calcium sulphate as a basic salt addition. Sulphate added to the boil might be appropriate for an American style stout with more hop bite than a traditional Irish stout. Frankly if you have the right balance of brewing ions from salt additions there really isn't any need for the use of the 5.2 product. A mash with the correct water profile will yield a proper pH level all by itself.
Twenty grams seems like a hell of a lot of gypsum for a dry stout. That would be about 4 teaspoons. The only way to intelligently answer your original question is to see both the recipe and your water profile.