A graduating New York University student was ejected from his commencement at Yankee Stadium yesterday after he was caught trying to steal home.

William Lopez, 21, of Manhasset, LI, was among 6,000 students who sat in the box seats behind home plate and along the first base and third base lines at the first graduation to take place at the House that Ruth Built.

NYU, which held its 176th commencement at the storied stadium because of construction at Washington Square Park, had a strict ground rule.

“The students had been repeatedly advised . . . that they were strictly prohibited from being on the field,” said NYU spokesman John Beckman.

About three-quarters of the way through the ceremony, Lopez, wearing his gown and mortarboard, leaped over the right-field fence onto the field.

He sprinted across the outfield behind second base and made it to third, as many in the crowd, which also included 20,000 guests, cheered him on.

Lopez, a Yankee and Met fan, turned for home as stadium security and NYPD cops tackled him just feet from his goal.

“I was trying to make it to home plate,” Lopez told The Post after he was issued a summons for trespass. “I wanted to do a head-first dive. I almost made it, only 10 feet to go.”

The Tisch School of the Arts grad said cops told him, “You ruined your graduation, and I said, ‘Are you kidding me? The crowd was cheering me on.’ ”

Lopez’s father, Bob Lopez, said when he saw the figure running on the field, “My wife asked, ‘Could that be William?’ I said, ‘No. That kid’s an athlete.”

His son said, “This is the first and last graduation at Yankee Stadium. There’s no better stage than this.’ ”

But Beckman said that “the Yankees were very gracious hosts and we were grateful to be allowed to be there, and it is always disappointing to us when one member of our community thinks there’s a special set of rules for him or her.”

rita.delfiner@nypost.com