They're both rivals, at least that seems to be the hot take on it.
As far as courses go I can't say anything. But there's a few boons I can offer (biased for Edinburgh) that make it a bit more convenient for lifestyle or exploration.
- if you're poor they give a good 5k bonus to you (hehe)
- good rail links to Glasgow and hence the rest of Scotland, at least better than St Andrews which doesn't even have a station and needs a bus to one nearby
- lots and lots of hills nearby (borders, Pentlands, via rather fast bus access)
- very good birding opportunities nearby (which Andrews also has to the east: Fife coast is great for this mind you) in east Lothian, which also has many great beaches. The difference personally is that ours are more accessible by bicycle
- Arthur's Seat (I like the subsidiaries, not the seat itself. Don't see an extinct volcano in Andrews do you?)
- the Edinburgh natural history society (which organizes trips to see sights as far as St Andrews anyway)
- idk if you'd care but, London is fairly accessible via LNER or Avanti. Lumo is also coming soon which will make it even cheaper to get to London, faster too.
Anyway this is the biased nature-oriented view... But yeah, I'd take Edinburgh over Andrews any day. (oh you can also get super cheap tickets to Berwick and walk to Holy Island. Picture it.. Holy Island. Quite a nice ring to it, eh?)