You need to reach hospet. That's the nearest rail head for hampi, the world heritage site. You will get city busses from the station to hampi /search/507/0/506
From hampi to badami, u again need to come bACK to gadag to catch a train. You ll get busses to anywhere from Hospet bus stand. For details, you can check ksrtc.in the official website for karnataka state road transport Corporation
Important Note:This website NEVER solicits for Money or Donations. Please beware of anyone requesting/demanding money on behalf of IRI. Thanks. Disclaimer: This website has NO affiliation with the Government-run site of Indian Railways. This site does NOT claim 100% accuracy of fast-changing Rail Information. YOU are responsible for independently confirming the validity of information through other sources.