Machu Picchu is one of the most amazing places to visit. But it involves getting to Cuzco and taking the train from there. Once you arrive in Cuzco this is a 2 day affair. That is, if you want any real time sightseeing the ruins. You could in theory take the train up and back on the same day. But you would only have a couple of hours to look around.
Ideally this is how the 2 days visiting would look like. Early day 1 take the train up from Cuzco to Aguas Calientes. This is the closest town to Machu Picchu and where the train station is located. Take the day to rest and adjust to the elevation. Early the next morning, Day 2, make the trek by bus or hiking to Machu Picchu. Take advantage of the day at Macchu Picchu. Afternoon back to Aguas, then ride train back to Cuzco.
Other data points:
1. Trains only depart from Cuzco no later than 10am. And return trips from Aguas Calientes in afternoon. (From what I've experienced maybe its changed)
2. You need a ticket to visit Machu Picchu. Additionally there is a daily limit sold. So buying well in advance is advisable.
Here is a link I found that is useful and pretty much goes along with the experience I had.
Getting to Machu Picchu by Train
Hopefully this helps you get an idea of how much time you need. And if visiting Machu Picchu fits your plans. TBH you'll be cutting it close.