I can recommend neither method.
Most dishwashers do not get hot enough to kill bacteria in a sponge, and the dish-drying cycle is not capable of drying a sponge. Washing a bacteria-laden kitchen sponge in the dishwasher will only redistribute live bacteria all over the dishes. Moist bacteria thrive, but a dry bacterium is a dead bacterium; this is why one should never stack dishes while they are damp.
Sterilizing kitchen sponges in the microwave is possible but tricky: the entire sponge must reach boiling temperature, and the recommended length of time ranges from 30 to 90 seconds, depending upon the size of the sponge and the power of the microwave. Unfortunately, if you miscalculate and the sponge dries out completely in the microwave, it can burst into flame.
I avoid the issue entirely by using a fresh, clean dishcloth each time I wash dishes or wipe the counters.