I’ve used Ivermectin based preparations on my hamsters before as a preventative treatment but I know that from speaking to others who have had issues with mites/lice that sometimes the parasites seem to be resistant to it and something stronger such as Selamectin may be needed but this will only be available with a prescription from a vet.
This is the Ivermectin preparation that I use:
https://www.petdrugsonline.co.uk/pha...ops-cage-birds
(It says cage birds but it can be given to both Syrian and Dwarf hamsters)