I have done the trip in a scooter (the whole classic trip in fact), and it took me about 3 hours, and it certainly is possible to do the trip in a day.
But I recommend you to stay a day in Pai. It's a nice little town, and one of the best things to do it watching the sunset at Pai canyon, which you wouldn't be able to do if you were to return the bike at 6PM. There are plenty of scooter rentals in Chiang Mai, and you can easily negotiate to get the bike for 2 days which gives you a night at Pai.
When you have a scooter, the Tham Lot cave is an hour away from Pai. Self plug: https://travelemy.com/Thailand/Tham-Lot-Cave