I had the same problem and my small town repair man told me I needed a new motor or just buy a new dishwasher. My dishwasher was only three years old so I refused to do either. I ran an empty dish washer with Lime Away. It sounds harsh but the bottle says you can use it to clean coffee pots and other kitchen appliances. I feeled the dispenser and ran the hottest cycle. You can also throw salt or citric acid in the bottom as you run it too. I have also heard to run a cycle using Tang but I haven't tried it.
One other thing that might help to is to replace the "flapper" at the back of your dishwasher. I don't know the real part but it closes over the hose at the back to prevent stuff from flushing back into your dishwasher.
My dishwasher is now eight years old and it is has been doing it again. Eventually, I know this trick won't work and I may have to buy a new dishwasher but I got five more years out of my dishwasher. I have a Whirlpool, and was curious what brand you have.
Good luck, I will be watching for other responses, too.