According to WOTC developer Rodney Thompson, Wild Magic Surge wasn't intended to cost spell slots, so this should certainly be enough to prove the intention behind Wild Magic Surge.
Given the ambiguity of the RAW in this area, and the (let's face it, fairly nonsensical) consequences of deciding that Wild Magic Surge costs spell slots, I would personally stick with RAI and the considerably simpler and easier interpretation of the rules.
Besides all that, the Wild Mage is already a very underpowered option with numerous issues. Nerfing it further just seems downright cruel.
This could only work for some effects.
Dispel Magic will only mitigate some Wild Magic Surge effects; specifically those that have a persistent effect on you personally. For example, dispel magic won't help against a fireball you cast on yourself. Fireball would need to be counterspelled, but contingency only works spells with a casting time of one action, and counterspell has a casting time of one reaction.
Another important thing to note about dispel magic is that it's indiscriminate:
Choose one creature, object, or magical effect within range. Any spell of 3rd level or lower on the target ends. For each spell of 4th level or higher on the target, make an ability check using your spellcasting ability. The DC equals 10 + the spell’s level. On a successful check, the spell ends.
A spellcaster doesn't get to pick and choose which effects get dispelled, so the contingent dispel magic will also affect any defensive or protective spells that are affecting them.
Further, while there are no limits in the PHB on the complexity of the condition that can be defined for contingency, the DM might not allow overly long or convoluted conditions. For example, in order to prevent abuse, they might require that a player whose character is casting contingency verbally express the triggering condition without recourse to notes. Or they might only allow simple conditions without any kind of logical conjunctions (and, or, if, etc).
In this particular case, the DM might rule that the player doesn't know all of the possible outcomes from a Wild Magic Surge, and so there's no way they can enumerate them all in order to protect themselves.
... "what if the condition instead was: if Wild Magic Surge affects me or my allies in a harmful or disadvantageous way, except a self-fireball?"
The DM might also limit the amount of decision-making that a contingency can perform. Conditions that include phrases like "in a harmful or disadvantageous way" might not be possible, or (worse) not be reliable; the contingency spell might (for example) decide that turning into a potted plant is advantageous under some circumstances.
Additionally, remember that contingency only casts the spell on the caster, not on any other targets. If you really want to cast dispel magic on yourself any time a Wild Magic Surge affects your allies, you can, but that's probably not what you want.
Best Answer
Only wild magic effects that specifically cast spells can be managed with these methods.
Looking at the Wild Magic Surge table (PHB, p. 104), there are generally four categories of effects that can be rolled:
So why can't dispel magic help, especially for cases like category #2? Here's the spell wording:
And here's a very important clarification from the Sage Advice column:
By my count, of the 50 different effects on the Wild Magic Surge table, nine of them can be counterspelled, and seven of those (all except fireball and magic missile) have durations and can be dispelled.