Do the random vampire attacks end when you finish the main Dawnguard quest?
Yes, the attacks do end after finishing the main quest.
Tangentially, the attacks will begin as soon as you install Dawnguard, not after beginning Dawnguard-related quests. Some consider this a misfeature enough that a mod was quickly created to delay the attacks until the start of the main Dawnguard quest (Dawnguard - No Vamp Attacks - WIP by IsharaMeradin, no longer available, Wayback Machine link). It’s that bad.
More recent mods to solve this problem are:
- Timing is Everything - Quest Delay and Timing Control, a general-purpose quest delayer/control that includes Dawnguard
- Dawnguard no Vampire Attacks SSE
- Dawnguard Away - No Random Vampire Attacks in Towns - Delay Main Quest
… and so on. Basically, just search your favourite mod repository for dawnguard attack
or quest delay
and you’ll come up with a bunch of mods, if you’re interested in delaying or disabling the vampire attacks.