It is very easy to get to Bang Pa-In from Ayutthaya. Just take the train (see timetable HERE), the ticket costs only 3 THB. From Bang Pa-In railway station, take a taxi (songthaew) that is just waiting in frontor walk 50 meters to the moto-taxis station (20 THB to go to the palace by motorcycle taxi and 30 THB by songthaew). You can also wlak to the palace, count 25 minutes.
There is also a local bus connecting Ayutthaya and Bang Pa-In (25 THB) but it is more expensive and less convenient than the train. Otherwise, you can hire a tuk-tuk from Ayutthaya to go, visit and come back (around 500 THB for a 2 hours trip). You can also come to bang Pa-in by train from Bangkok (1h30 - 12 THB)