Barnhart attended Paw Paw High School in Paw Paw, Michigan. Over his prep career, he was graded as a 4-star recruit by rivals.com and 247 Sports, and was a 3-star recruit via ESPN. He chose to join Michigan over many other power 5 offers.
Barnhart appeared in 2 games as a freshman, earning a redshirt for the 2019 season. In 2020, he appeared in all six games with four starts at left tackle and also played on special teams. He allowed 1 sack on the year.
In 2021, he appeared in 10 games including eight across the offensive line with two starts at left guard. He contributed on special teams as well, and allowed no sacks on the year.
Barnhart appeared in 10 games with 9 starts in 2022, playing 8 of his 9 starts at right tackle. He allowed 1 sack on the year.
Barnhart returned to Michigan in 2023 and started all 15 games on the offensive line (four left tackle, eight right tackle, three right guard) and contributed on special teams. He allowed 4 sacks on the year.