Interesting question, Borg vs. Dominion. Reminds me of the joke that Voyager would get home and there was nothing left, all destroyed.
However...
1. The Dominion had long-range plans for the Federation. Supposedly they knew of the AQ powers and were planning to confront them as part of a natural expansion within several hundred years, but the wormhole discovery sped that up.
With a long-range plan for galactic supremacy, the Dominion would not necessary rush into conflict. That said, it seemed that this earlier principle did not play as big a role later on in DS9.
2. The Dominion preferred to manipulate or use outside conflicts to its advantage. Sort of like the Romulans, the Dominion attempted to instigate a war between the Federation and Tzenkethi. They also probably had a role in causing the Klingon-Cardassian war.
The Dominion has been known also for forgoing short-term strategic advantages for a long-term benefit later on.
If the Borg attacked the Federation, the main power in the AQ, the Dominion might simply step back and watch as the Federation was severely weakened by its cybernetic nemesis, then attempt to sweep in and pick up the pieces.
3. Dominion vs. Borg? In the GQ we saw no evidence that the Dominion had encountered the Borg. IMO, both sides have compelling strengths and weaknesses against the other, stacked up somewhat closely. However, I tend to give the advantage to the Borg in terms of weapons adaptability (although the polaron beams were quite devastating at first, as pointed out by other posters they became less effective, and the Dominion did not evidently regain that advantage). IMO the Jem'Hadar are good assimilation stock, and the Vorta can be assimilated as well (provided they don't activate their termination implant in time).
However a possible trump card are changelings, which may be able to infiltrate cubes disguised as metals, etc. But it would be a war of attrition; I suspect that the Borg might be able to assimilate a weakened changeling but might opt for destruction instead.
The Dominion might reevaluate its strategic interests in the event of a Borg invasion of the AQ, and retreat and consider options against a Borg invasion of the GQ.
I do think that the Federation shown initial weakness in terms of raw numbers and power than the Dominion, but has a greater strength in adaptability, ingenuity, and special technologies over time. This enabled them to defeat the Dominion, and the Borg on a number of occasions. The freedom of thought encouraged by Starfleet officers, but lacking in the rigid discipline of the Jem'Hadar, makes the Dominion more vulnerable to the Borg in multiple engagements.