Time is even less than you think as this is a tender port.
You are unlikely to be in the city before 9am if lucky, and need to be away by 3pm if not sooner.
Where you get off depends on which sights you plan to see. Personally I would get off at Connolly and transfer to the LUAS tram.
Tara Street station is only 5 minutes walk from Trinity College.
I've also been checking the new bus schedules- buses 7 and 7a with a combined frequency of 4 an hour get to Trinity College from Dun Laoghaire in 36 minutes then on to O' Connell Street, and beyond. They go past the American Embassy in Ballsbridge.
As for tickets the wise visitor orders a Visitor Leap Card on line, which is then mailed to you. https://about.leapcard.ie/leap-visitor-card