Urbino has no train station. You can take a train to Fano. From there, it continues by public bus.
The train from Ancona to Fano takes 30-35 minutes and costs € 3.30 to € 7.50 per person (one way). There are several trains, but not every hour. It's good to check the timetable in advance.
If you leave the train station of Fano, on the left you will find a bus terminal. Take bus N° 25 to Urbino. The ride takes 1h20min and costs € 4.30 per person (one way). There is 1 bus per hour. The last stop is Borgo Mercatale, near the entrance of Urbino. You can check the timetable of bus No. 25 here.
How do I get to the train station from the cruise port in Ancona?
Ancona train station is situated at Piazza Rosselli at about 1.5 km from the cruise port. You can go there by taxi (€ 10, 4 persons one way) or you can walk. If you leave the pier, go to the right. Stay in the lower part by the port. Once past the security gateway the train station is already indicated.
TIP: Just when you're away from your cruise ship, you will pass a small train station. You can not take a train here, but there is a stop for bus N° 12. This brings you in 10 minutes to the train station for € 1.20 per person (one way). In high season there is a bus every 20 minutes. In low season it runs much less frequently. You can check it here. (line 12, stop Parcheggio Archi, Molo Sud).