In the Synthesis and Control endings, I imagine it probably wouldn't take very long. Not with the Reapers involved in the process, at least. Maybe a few months or a couple of years at most. In Destroy, well...I have a difficult time imagining that the mass relays can be repaired at all. I don't know if the current civilizations have so much as figured out how they work, what substance they're made of, etc.
Which, to me, only makes the completely hopeful and triumphant tone of the(best possible) Destroy ending feel all the more awkward and jarring. I have a hard time believing that things can and will work out all that well, considering.
Considering that in ME2, Matriarch Aethyta comments on how she proposed the Asari should build their own Mass Relays, I believe that they have a good baseline understanding on how they work. This would most likely contribute to the accelerated repair of the relays even in the destroy ending.
Hackett clearly says in the destroy ending that EVERYTHING can be rebuilt. And seeing as the galaxy built the crucible in a few month, I'd say rebuilding the mass relays would take maybe a few years.
Aren't mass relays essentially just giant element zero cores? assuming the core was destroyed, the primary obstacle to repair/rebuilding would be mining the required eezo. So it depends on the availbility of eezo.
I imagine structural damage to the stations themselves would be relativly easy to repair.