Your dog is most likely defecating from nerves, yes. I recommend taking him on a good long walk right beforehand, maybe even walk him to the groomer's. Make sure it's a positive experience for him. If the groomer's = walks and a treat for him, he may improve. Many dogs are just unnerved by nail clipping, baths, etc. The best thing you can do for him is remain calm but dominant and assertive.