Metzerlen-Mariastein is a municipality in the district Dorneck in the canton of Solothurn in Switzerland.