Identify the type of stain. Red or brown stains are usually caused by iron or rust. Greenish blue stains come from copper. Brown or black stains are caused by manganese or other minerals.
Buy an acidic cleaner. They get rid of discoloration from copper, aluminum, bronze and brass. Acids also eliminate rust stains caused by iron. Read the labels and look for one that specifies rust removal. Cleaners that focus on toilet bowls, cleaning metal or removing rust are the best bet.
Put some cleaner or rust remover in your dishwasher's soap dispenser cup. In addition, sprinkle some on the bottom of the dishwasher. Run the dishwasher through a cycle. Repeat if necessary.
Scrub away the stains. If the stains are persistent, rub them with a brush or scrub sponge and a gentle cleaner.
Run the rinse cycle to remove any remaining residue.