If food residue or dirty dishware is stored in the dishwasher for prolonged periods of time, bad odors can develop.
Do not store dirty dishware in the dishwasher for prolonged periods.
Run a rinse/quick wash cycle every few days, even if the dishwasher is not full.
This will stop the dishware from smelling bad.