You can put steel wool as an abrasive agent on your dishwasher racks to remove the rust. Although not a permanent fixture, you'll need to gently rub rust off the racks taking care not to scratch or mar the finish. You can also use fine sandpaper to abrade the surface and remove minor rust.
A commercial rust remover product labeled safe for use in a dishwasher is another option. Generally, you start a cycle in your empty dishwasher and, as the water fills the machine, open the door add the rust remover. Running the entire cycle usually removes all the rust. In some cases, you may need to run it twice. You should read your owner's manual before using a commercial rust remover to ensure that is is safe to do so.
Over time, the enamel coating may wear off dishwasher tines. Once this occurs, the tines readily become rusted. You can buy replacement tips at an appliance store. These small, plastic tips fit over the dishwasher tines, protecting dishes and preventing rust.
Rust and hard water spots can leave unsightly stains on dishes, as well as the dishwasher. If the problem continues, have a plumber install an iron filter in the pipe to permanently eliminate rust in the dishwasher. For general maintenance, use only the recommended amount of detergent and use water that is at least 120 degrees Fahrenheit. Clean the filter out at least annually, or as recommended by the owner's manual. Scrape food from dishes before placing them in the dishwasher.