You can, but it is not a good idea. If you buy online, you must take the booked train or one in the next 90 minutes. If your flight is delayed, you could lose your money.
Buy when you get to the station at FCO.
For €20 more, DW and I take a taxi straight to our hotel.