Elections will not legitimize any government if they are rigged.Even if they aren't rigged.
Such as when all the choices are selected from the ruling elite class. Or when there is universal sufrage and the winner is the one most willing to loot the public treasury.
Governments are "legitimate" becuase they RULE. They use force of violence to RULE. That is what makes them legitimate. Dictatorships and monarchies are legitimate.
Obama vs. McCain
Obama vs. Romney
Communist vs. Socialist