I can only answer for US requirements and UK requirements.
Yes, you can have a rapid antigen test to satisfy US entry requirements. As you say, three days before. Class the three days from your flight from Dublin to be safe which I'm sure will be on the same day anyway. You need an attestation form to claim your test results are true. You can fill this in at the airport if you have no access to a printer so it's not a problem.
Yes. The UK is basically the same requirements as the US but you need to book your Day 2 test before travelling back as the order reference needs inputting into your Passenger Locator Form. Some companies let you take tests with you which are more convenient as you can take them at your place of stay.
When it comes to travelling through Dublin I have absolutely no idea. I have no clue about Irish transit requirements regarding tests, passenger locator forms etc.
This is all with the presumption it's for USC travel. Obviously, I'm sure you know there is more involved if you're a UKC.