How can I prevent the odor in my dishwasher?
Try throwing some baking soda and lemon juice in it and run an empty load without soap. Repeat as needed. 

I'd try about half a normal sized box of baking soda and half to a whole cup of lemon juice.