Muzzles are an important tool in many situations. While I do not believe a dog should be muzzled and then forced into a scary situation and be "made to deal with it", I do realize there are going to be times in a dog's life that may be unavoidably scary. Having worked for a long time in a veterinary hospital I know all too well that pain and fear can cause a normally lovely dog to try to defend itself. Ensuring that a dog is already acclimated to wearing a muzzle without fear or stress is a wonderful gift we can give to our dogs later on. They can also make excellent alternatives to an elizabethan collar (aka a "cone of shame") after a surgery.
For anyone who is looking to make a muzzle a positive training experience, I have a pretty thorough step by step program I do and the dogs typically take to it well. Here is a condensed version!
First and foremost, practice at times completely unrelated to trigger issues!!! Do not wait to do this when someone is on their way over or already there! Just spend a few minutes a day.
Start by letting your dog lick out the remnants of a yogurt cup! Put a cue on it, like "hat", "mask" or "muzzle". "Mask" was my husband's cue. We used basket muzzles for our Lab and Hound because they would eat poop in the yard. My husband hating saying he put a "muzzle" on his precious girl!!!
After a few days of this place the yogurt cup in the muzzle and give the cue.
After a few more days smear a little peanut butter or yogurt (messier) in the muzzle itself. Hold the muzzle cupped in your hand and give your cue. If your dog sticks their nose in, even a little, say "yes" and give an additional treat, preferably smooshed in through the basket. Do that a few times, end session.
After a few more days you should be able to start to build the length of time the dog is willing to have their face in the muzzle. Then you can begin to fuss with the straps. I use a lot of praise and treats as I begin to move the straps around. Don't rush this part. Buckling should be an absolute non-event. The sound itself can make a lot of dogs react so take your time!
Once you do buckle it, lots of treats in through the muzzle then remove and end session.
Over a few more days you will be able to slow the treats down.
Once that is happening, start to do other fun things while your dog is wearing it. Do some easy training skills, sit, down, paw, stay, etc. Lots of treats. Then take the muzzle off and end session and treats. Make sure the after session is even a little boring.
It won't take long until your dog actually gets excited to see the muzzle because it means fun things happen. So many people do this in reverse, they use the muzzle for something awful then try to convince the dog it is fun!
Clearly there is more to this and a dog who panics and may bite if suspicious will need a lot more careful work, but if you want to do a prevention bit of training, try it!