Interesting, two of my least favorite cities.
Madrid because it has no history, which makes it a unique city in Europe. I like old centers and Madrid has none. The Prado is a great museum but I'd trade time in Madrid for time in Toledo any day.
Dublin is one of my least favorites only because the draw in Ireland is the people and they are best experienced in small towns. Cities are, for the most part, cities. Lots of sights but also busy people living busy lives.
Of the two, I'd pick Dublin. There is history, better sights (with the exception of El Prado art gallery), and you have the advantage of doing your customs inspection before you fly home - which will save you time at your U.S. port of entry.