It's advised to clean the dishwasher monthly for frequent users and at least every six months for occasional users, but using bleach for this purpose requires some consideration.
If the interior of your dishwasher has any stainless steel components, The Home Depot recommends against using bleach, as it can corrode the steel and damage your appliance.
If your dishwasher is bleach-compatible, ensure you follow safety guidelines. Avoid mixing bleach with ammonia or another cleaning product, as this mixture produces harmful gasses.
Wear gloves and protective eyewear to prevent direct contact with bleach. Always use it in a well-ventilated area to avoid inhaling harmful fumes, or wear a respirator.