Unfortunately, there is no safe way to bathe a hamster. You should not even consider it unless the animal has something on its fur that is toxic. Hamsters groom themselves.
Hamsters should only be bathed if they get toxic/harmful substances on their fur. Otherwise bathing removes essential oils which can cause your pet to catch a chill and die.