Of course you can do that. Only Makkah and Madinah is out of bound for non-muslims. But you have to take transit visa from saudi authorities in Doha. In the transit visa you can not spend more than 3 days both wasy (33 days while u enter saudi from qatar and 3 days while u enter from Bahrain)in saudi . Have a nice and happy trip.