The HP/Mana fontains use auras to regenerate health/mana. Open these auras in the object editor and look for the field "targets allowed". There you can select stuff like "only ground units", "no invulnerable units", ...
If this isnt enough then you might have to trigger the regeneration yourself. To do so set the regeneration rate of the aura to zero, create a trigger that runs every ~0.5 seconds, picks all units around the fontain and adds some hp/mana to them. You can then use the condition in "Pick every unit in ... matching <Condition>" to filter which units should receive regeneration and which shouldnt.
But this is only one possible approach out of many...