I don't know if this works or not but I have read it somewhere I don't remember.
When you feel like washing your hands take a break. Like tell yourself I will wash my hands after 30 seconds. or else engage yourself like I will do this thing after that I will wash my hands.
You can try this technique and let us know if this works.