The Fighting Irish (26-0-0), who are in the final four for the third straight year, will play North Carolina on Sunday.
The Tar Heels advanced with a 1-0 victory over UCLA after Yael Averbuch, making her school-record 104th straight start, converted a penalty in the 41st minute.
Melissa Henderson, who played on the same club team as Barg before the two decided to go to Notre Dame together set up her fellow freshman. She sent a low cross into the right side of the box for Barg, who trapped it, then turned and fired a right-footed shot to the far side past Stanford goalkeeper Kira Maker.
"They've been great all year," Notre Dame coach Randy Waldrum said. "They both have been fantastic, and as the year has gone on, they've gotten better and better for us. We brought them in here knowing they were going to fill some big shoes for us over the next four years, and they definitely haven't let us down."
Stanford (22-2-1), which set a school record for wins in a season, had a pair of good scoring chances in the first half. But Notre Dame goalkeeper Kelsey Lysander turned away both chances. Lysander made a sliding save on a shot by Kelley O'Hara midway through the half, then stopped a header by Christen Press five minutes later.
Lysander had seven saves in the Notre Dame's 18th shutout of the season and eighth shutout in the last nine games.
The Cardinal dominated possession in the second half giving them a 20-12 advantage in shots overall, but failed to score for just the second time this season.
"I thought we got a little unlucky, and they got lucky and broke through when we had one breakdown in the first half," Stanford defender Allison Falk said. "They got a goal, and we didn't. That's soccer."
North Carolina (24-1-2) also scored after a nice play by a pair of freshmen. Emmalie Pfankuch threaded a pass to Brittani Bartock, who was taken down in the box about 12 yards from the goal by defender Erin Hardy.
Averbuch blasted her kick into the lower-right corner of the net past diving goalkeeper Ashley Thompson for her sixth goal of the season.
UCLA's best scoring opportunity came early in the second half, when Kara Lang got behind North Carolina's defense. But goalkeeper Ashlyn Harris saved Lang's shot from point-blank range and the Bruins (22-1-2) lost in the final four for the sixth consecutive season.
It was the Tar Heels' 17th shutout of the season and eighth in nine games.