Now that’s a motivational speech they can really take to the bank.

Billionaire tech investor Robert F. Smith stunned college graduates on Sunday as he gave their commencement speech — offering to pay their student debts despite it costing an estimated $40 million.

“On behalf of the eight generations of my family that have been in this country, we’re gonna put a little fuel in your bus,” Smith told the 400 graduating seniors at the all-male Morehouse College in Atlanta.

“This is my class, 2019. And my family is making a grant to eliminate their student loans.”

The announcement was initially met with stunned looks — before the graduates broke into cheers and tears at the largest gift ever given to the historically black college.

New Yorker Elijah Dormeus, 22, a business administration major from Harlem, was stunned at no longer having a $90,000 debt.

“If I could do a backflip, I would. I am deeply ecstatic,” he told the Atlanta Journal-Constitution.

His mother, Andrea Dormeus, a school bus driver who joined the rest of the family traveling from New York for the graduation, told the paper, “I wasn’t too worried, because my faith in God is really strong.”

Smith, founder of private equity firm Vista Equity Partners, was given an honorary doctorate during the ceremony and had already announced a $1.5 million gift to the school.

He told the graduates he expected them to “pay it forward” and said he hoped that “every class has the same opportunity going forward.”

Finance major Aaron Mitchum, 22, said just days ago he had calculated it might take him 25 years to pay back his $200,000 in student loans — 25 years at half his monthly salary, per his calculations.

“I was shocked. My heart dropped. We all cried. In the moment it was like a burden had been taken off,” he said.

Morehouse College president David A. Thomas said the gift would have a profound effect on the students’ futures.

“Many of my students are interested in going into teaching, for example, but leave with an amount of student debt that makes that untenable,” Thomas said.

“In some ways, it was a liberation gift for these young men that just opened up their choices.”

With Post wires