There was a kit for sale at the local electronics chain store that is supposed to do that. My neighbors dogs habit of howling at ambulance, fire& police sirens had me surely tempted to build one.
But, when you think about it, one needs a powerful tweeter to generate inaudible frequencies of sufficient level for that purpose. And tweeters are very directional in their output so, to *really* deter the dog it would have to be aimed directly at it. Quite impractical in my case and leaving it switched on constantly while aimed in the general direction would only let the dog get used to it and, perhaps, make it howl even more .
If you want to build something to avoid dogs with a sound blast, consider first the practicalities to carry a powerful tweeter horn with you and how to supply power to it, then, if you are happy with that, make an oscillator that tunes from 20 -30KHz and an amplifier that boosts the output to the maximum the tweeter can handle.
Pehaps they make piezo horns now that operate in that frequency range, check on this, might be simpler than finding a tweeter with a high enough frequency & wattage range. There are 'dog whistles' on the market but their output is so low it is more likely they attract dogs rather than deter them
Hi AG,I think if you blast loud ultrasonics at a big dog it will irritate him and he will probably bite you.
If you teach a dog that there is food available when there is an ultrasonic sound then maybe he will be attracted.