Epoxy paints are ideal for dishwashers and will seal off the damaged area to prevent future water damage. However, epoxy paints are hard to find, particularly in smaller towns. In addition, epoxy paints are very noxious and must be handled with caution. Remove the dish rack and paint it outside where the fumes can dissipate. For safety, wear a mask and gloves when using epoxy paint.
A spray paint intended to keep metal from rusting can be used with varying degrees of success. This type of paint is not intended for use on surfaces that receive regular, direct contact with water. As such, the paint will need touch-ups from time to time. If using a metal spray paint, look for a brand that offers advanced protection against water as well as rust.
Commercial repair kits designed for repairing a dishwasher rack are the best to use. The type of paint provided in the kit is safe to use on an appliance that comes into contact with water as well as dishes that will later be used to hold food. Find these kits directly from the manufacturer or at a local hardware store.
Once you have fixed the issue with rust, prevent it from re-occurring. Use care when loading and unloading dishes to avoid knocking the rack around and dinging it. Be on the lookout for small spots and scratches and treat them immediately. This prevents rust from forming in the future and keeps the interior of the dishwasher safe for your dishes. Smooth out rough areas near the rust with steel wool to provide the paint a good surface to create a lasting bond with the metal.