A four-time All-American swimmer at Stanford University says he was “kicked off” the team because he’s gay.

Abrahm DeVine posted on Instagram Sunday about the alleged discrimination he’s endured as the only openly gay swimmer “at my level” while calling for changes to the “homophobic aspects” he claims dominate collegiate athletics.

“Why is it my job to educate coaches and athletes at the most resourceful university in the world?” the two-time NCAA 400-meter individual medley champ wrote. “I cannot continue to try to engage people in this conversation when there is so much fragility to obscure my humanity and character, so much rhetoric to keep me silent.”

DeVine, a 23-year-old Seattle native who was a four-time All-American at Stanford in the 200-yard individual medley, said the post was intended to raise awareness of the “outright aggressions” he experienced while on the team.

“Plain and simple: there are surface level reasons I was kicked off the Stanford swim team, but I can tell you with certainty that it comes down to the fact that I am gay,” DeVine’s post continued. “This is a pattern. Homophobia is systematic, intelligently and masterfully designed to keep me silent and to push me out.”

In a statement to The Post on Friday, coaches at Stanford denied DeVine’s claims.

“It is truly unfortunate Abe feels this way,” the coaches for its men’s and women’s swim teams said. “That said, Abe wasn’t invited back to train with us this fall, as a postgraduate, for reasons entirely unrelated to his sexuality. We take pride in the inclusivity and supportiveness that exists on both our men’s and women’s teams, but we will continue to strive, as always, to improve those aspects of our culture.”

Nick Sako, an assistant athletics director at the university, told The Post that he was unable to provide additional details.

DeVine, who graduated last spring, most recently swam in July for Team USA at the World Aquatics Championship in South Korea. He had been training at Stanford as a professional, according to SwimSwam.com, a website that tracks competitive swimming. DeVine’s Instagram post didn’t explain exactly what he meant by “kicked off” the team.

The former Pac-12 Swimmer of the Year as a junior told Swimming World Magazine last year about how his team reacted when he came out as gay, saying his fears that he wouldn’t be accepted were unfounded.

“I remember that being a pretty emotional time, and just feeling my whole team wrap around me and feeling that love in a place where I hadn’t really felt it, that was definitely pretty special for me,” DeVine said. “Just seeing them kind of prove me wrong was definitely special, something I’ll never forget.”