Discharging the capacitor of a microwave oven is generally recommended as a safety precaution, but it should be done with caution and by a qualified technician. The high-voltage capacitor in a microwave oven stores electrical energy even when the unit is unplugged, and it can retain a dangerous charge that could cause electric shock if mishandled.
If you are not trained or experienced in handling high-voltage electronics, it is best to leave the task of discharging the capacitor to a professional technician or contact the manufacturer for assistance. They will have the necessary knowledge and tools to safely discharge the capacitor and handle any repairs or maintenance required.
It's important to prioritize safety when dealing with electrical appliances, especially those that contain high-voltage components.