Both find themselves embroiled in a global maelstrom that has sparked reaction from US presidential candidate Donald Trump, Harry Potter author J.K Rowling and a host of commentators.
Online, they have been subjected to "an awful lot of abuse", Mark Adams, spokesman for the International Olympic Committee, said on Friday.
Khelif grew up in a poor rural family in the dusty Algerian province of Tiaret on the edge of the Sahara desert, a place of high temperatures and traditional values.
Her desire to play football with boys -- and her ability to upstage them -- led to intimidation and occasionally violence, with her talent for dodging punches leading her to consider taking up boxing.
To do so, she needed the approval of her father, a welder, as well as money to afford the bus trips to a training centre in a local town, an expense she helped pay for by collecting scrap metal.
"At the start of my career I felt that I might not be able to continue... because my family did not accept the idea, and also the views of society, which considered that I was doing something bad by doing my sport," she told the official Algerian news agency APS in 2022.
After a career that has since taken her to the Olympics twice and the world championships, her parents are now "her biggest fans," the 25-year-old told Unicef this year when she was appointed a national ambassador by the UN's children's agency.
In 2019 she represented Algeria at the world championships in Russia, competing in the same 57kg category as Lin.
After two byes in the early rounds, she crashed out in her first bout, while Lin went on to collect bronze.
But her career was on an upward trajectory.
After putting on weight, she competed in the 60kg category at the Tokyo Olympics in 2021, making it to the quarterfinals, where she was defeated 5-0 by eventual champion Kellie Harrington from Ireland.
Last year she made it to the semi-finals of the world championships in New Delhi, only to be disqualified after failing unspecified gender eligibility tests organised by the International Boxing Association (IBA).
She initially appealed but then withdrew her complaint, according to the IBA.
'Ignore the haters'
Lin, a two-time world champion aged 28, grew up in the Taiwanese capital Taipei in a troubled home.
She and her brother were fans of Japanese anime "The First Step", which features a bullied youngster who became a great boxer.
But it was seeing her mother's suffering at the hands of her father that led her to take up the sport in junior high school.
"I joined the boxing team hoping that I can protect my mother with my own strength," she once told Taiwanese television.
She was fast-tracked into the Taiwanese youth team and established herself internationally by winning a world title in 2018.
The Tokyo Games gave her a first taste of the Olympics, one that ended in bitter disappointment when she lost in the first round in a bout which she said left her "heartbroken".
A year later she bounced back to clinch a world championship gold again, and then once more at the Asian Games in late 2023.
Like Khelif, she was disqualified mid-competition at the 2023 world championships in New Delhi on the basis of gender eligibility tests.
She did not contest the decision, the IBA said.
Outside of the ring, she said she faces questions about her gender because of her short hair.
"If I wore my hair long, I would have to spend too much time tending to it and have no time to rest between morning and afternoon training sessions. How could I perform well that way?" she said.
"All I can do is prepare and try my best to ignore what the haters say," Lin told the CNA news agency.