To keep your dishwasher smelling fresh run a cycle (without dishes) using powdered lemonade instead of dishwashing detergent. Not only will this deodorize the dishwasher, but it will help remove the hard water stains.
If your dishwasher interior just seems to retain odors put a few teaspoons of baking soda on the floor of the dishwasher and leave it overnight. Baking soda does a great job of absorbing odors and it will wash away during the next regular wash cycle.
Finally, some dishwashers have filters that need cleaning. Be sure to follow the manufacturer’s directions and clean out the filters often.