With there being no guaranteed preventative for Leeches, you're going to need to know what to do if you find one on your dog. You have two options: Leave it and it will fall off by itself in 20-30 minutes or remove it.
If you choose to remove it, you can use a flat solid object like a credit card, driver's licence or fingernail to scrape between your pet and the Leech's, causing it to detach. Alternatively, you could carefully pull it off or apply salt to the Leech to make it drop off. Try not to squeeze the Leech when you remove it as this could cause the Leech to regurgitate, which can introduce bacteria to the wound.
Once the Leech is removed, wash with warm water and apply pressure to the attachment site with a cotton ball until bleeding stops.