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