Fast answer
Choose Valle d'Itria when the trip is mainly inland: white-town evenings, trulli countryside, Alberobello, Locorotondo, Cisternino, Martina Franca, and car-led loops. Choose Monopoli when the fixed point is the coast: beach time, sea walks, rail convenience, and a first-arrival base with more coastal infrastructure. The two can pair well, but they should not be asked to solve the same nights.
If you only do one thing
Default inland when trulli, white towns, and countryside drives are the reason for the trip. Default to Monopoli when the sea, rail arrival, or coastal dinners would otherwise keep pulling the itinerary away from the valley.