The alarm chirps and your dog runs to hide. First follow the alarm's safety instructions: check for fire or another hazard, leave the building if needed, and call emergency services as appropriate. Do not silence or disconnect a working alarm just to stop the barking. If it is a low-battery chirp, replace the battery or address the device fault promptly.
Once everyone is safe, give your dog a quiet room where they can retreat. Avoid dragging them toward the sound or holding them beside the alarm. If they are so frightened that they may bolt during an evacuation, plan ahead: know where their secure lead or carrier is and practice calm exits on ordinary days. A dog with intense noise fear may benefit from veterinary and qualified, reward-based behavior help.
Practice separately from a real alarm
A real safety alarm should never be the training exercise. Ask a professional about suitable recordings at a very low level if your dog is strongly affected. Pair a barely audible version with something pleasant while the dog remains relaxed, and increase only gradually across short sessions. If they refuse food, shake, or hide, the sound is too intense. Keep the alarm functional throughout. Once you have checked the alarm and everyone is safe, the noise-fear guide can help you plan around sudden sounds, never disable a needed safety alarm
Do not trade human fire safety for a quieter dog. The aim is a household that can respond to an alarm and help the dog move safely, with training outside the emergency.
Sources: NFPA: Learn the Sounds of Fire Safety. Dogs Trust: What to do if your dog is scared of loud noises. VCA Animal Hospitals: Fear of Noises in Dogs.