Fast answer
A Polignano day trip from Monopoli works best when Monopoli remains the luggage base and Polignano gets a focused rail day for cliffs, viewpoints, the compact old town, and a short sea-facing visit. The plan should be built around current departures and returns, not static train times or a promise that every traveler can improvise the same day.
If you only do one thing
Default to sleeping in Monopoli, checking the current train options, and treating Polignano as a focused day rather than a reason to move hotels. That keeps dinner, luggage, beach alternatives, and the next morning simpler while still giving Polignano enough space to be the main excursion of the day.