Having suds in the dishwasher is mostly due to using a wrong detergent, 

Use only the special dishwasher detergent to avoid suds. If this occurs, open the dishwasher and let suds evaporate. Add 1 gallon of cold water to the bottom of the dishwasher.

Close the dishwasher door, then select any cycle. Initially, the dishwasher will drain out the water. Open the door after draining stage is complete and check if the suds have disappeared.

Repeat if necessary