We are... not allowed to keep a dog as a pet, since it is not a very clean animal. How often have you come across the nasty sight of dogs taken for a walk licking their own excrement? Isn’t it disgusting to see their owners kissing the mouth of such animals after such incidents as if nothing happened? Would you kiss the mouth of your own baby if he were to do the same? Think how many parasites and microbes may be hiding in their mouths.
The Prophet (peace and blessings be upon him) has spared us from being contaminated by such filth when he ordered us to stay clear of the saliva of dogs. If we ever come into contact with a dog’s saliva we must wash the spot seven times, the first of which should be with sand or dirt. It is also possible to use a bacterial soap instead of sand or dirt.
In conclusion: Don’t contemplate taking a dog home as a pet. If, however, you do need to keep a dog for [one of the 5 stated purposes at the link], then you may do so. But take every precaution not to have contact with its saliva, and also arrange for a separate living space.