You need to wipe it off as a good practice. The foam will have dirt collated from washing and if not wiped off, it will serve as a breeding ground for fungii and bacteria.
So once your laundry is done, give it a good wipe where you see water, soap collected and those gaps wherever accessible. Same goes for the detergent dispenser.
For those looking to give a regular wash, do a hot wash cycle with citric acid/nimbusaat. It is more than sufficient to clean the wash drum.