If a dish cloth smells bad, don’t use it to wash anything. Whatever is causing it to smell bad (bacteria, decaying food residue, etc.) will be smeared all over the dishes you want to clean, which is exactly the opposite of what cleaning should accomplish.
Once a dish cloth gets smelly, wash it with hot water and detergent, and dry it on a hot setting. If you need to disinfect it, bleach would be an option to consider. (Mix the water/bleach ratio according to directions on the bottle.)
Washing and drying hot, as well as using bleach, can have ill-effects on colourful cloths, so take a lesson from hotels and stock up on utilitarian, easy to wash white cloths and towels.
Some cloths are simply too far gone. If there’s a smell even after you wash it and bleach it, it’s time to bid adieu to the cloth. They’re reasonably cheap to buy, and often come in large bulk packs.
Ideally, it should never come to this. An ounce of prevention will keep odours from developing, so don’t let it get bad enough to require drastic laundry intervention.
Between uses, don’t let your wash cloth stay wet in the bottom of the sink. Rinse it with hot water, wring it out, and hang it above a waterproof surface where it can drip dry. To speed things up, make sure there is good air circulation around all parts of the cloth, front and back.
Take action at the first sign of trouble. If you notice a slight smell in your dish cloth, let it dry, swap it out for a fresh cloth, and wash it thoroughly. Make it a regular habit to swap out dish cloths every day or two to prevent odours from developing in the first place
What about those sponges wrapped in a cloth pouch? They’re much harder to clean, and nearly impossible to adequately disinfect. You’d have to rinse it thoroughly and put it in a place with plenty of airflow surrounding it. The problem is that sponges stay damp longer, and it’s this dampness that can lead to bacterial growth. Getting all the little sponge holes clean and free of grease would require more hot water, soap, rinsing and wringing than human hands can handle. They may be convenient, but they’re problematic in practice.