Or can I just buy it at the airport after clearing the immigration, customs etc. Travel date is 3rd week of May, 2024. Thanks.
I am not 100% clear on what you want to buy, but if its a regionale train, you can absolutely buy the ticket when you arrive at the station.
Just buy when you get there. It is a regional commuter train, no reservations are possible, technically it can not "sell out" and from a practical standpoint never that crowded. Just buy a ticket, validate it, and go. If you will have cell service and the Trenitalia app, you can buy your ticket on the app, you board, tap the button on the app to "check in" and your on your way.
Just in general, it’s better to wait to buy train tickets until after you get off your flight, in case the flight is delayed.
Thank you all!