Nowadays, technology is helping everyone to cover their basic hygiene needs. During the COVID-19 pandemic, every person has started taking precautions, such as hand sanitization, wearing of masks, and social distancing. In this paper, the authors are focusing on hand sanitization. Latest sanitizer machines dispense sanitizer automatically because of touchless technology, but excessive use of sanitizer is harmful to the human skin. To address this issue, a smart sanitizer dispenser based on the Internet of Things (IoT) and Machine Learning (ML) has been proposed to fight against COVID-19. The proposed solution captures the image of hands and based on the size of hands and the number of germs present on the hands, the machine will dispense the sanitizer. In this way, the damage to human skin caused due to the excessive use of sanitizer can be reduced and the amount of sanitizer can also be saved.