Dublin is located on the east coast of Ireland. It gets less rain then cities of the west, but there are still lots of days with some rain, usually not heavy and for a short duration, so expect a mix of weather when you go.
Dublin's position allows it to have "better" weather than much of Ireland.
May through August are good times to visit Dublin. You'll have the best chance for sunny and warm weather in July and August, although you'll have to share it with throngs of people. Reserve your hotel ahead.
You don't travel to Dublin for the weather, whenever you go. Be prepared for a little rain, and enjoy your time there.
The climate charts below show the historic high and low temperatures and average monthly rainfall for Dublin, Ireland.
The Charles Stewart Guesthouse (value)
Generator Hostel Dublin (value)