JOSELIN LINDER, a 42-year-old writer who lives in Brooklyn with her husband, Aaron, and their dogs, Dee Dee and Orson, was born with a gene unique to her family. It has killed five members and threatens to do the same to the surviving carriers. She reveals the pain of her diagnosis and her family’s race to find a cure in her new book, “The Family Gene: A Mission to Turn My Deadly Inheritance into a Hopeful Future” (Ecco), out this month. Here, she exclusively tells her story to The Post:

I have a wonderful life, and yet I spend every day knowing what will likely kill me.

Being aware of this fact feels like I’m watching a car drive into the side of a building in slow motion: “I should be able to stop this,” I think, “but how?”

I was 22 when I learned I am a carrier of an orphan gene, a genetic mistake unique to my family. It causes us to suffer from a potentially fatal condition that affects the portal vein in the liver, leading to an inability to digest protein — and ultimately starvation. The condition and the gene are not yet named, although they have been extensively studied for more than 20 years by Harvard Medical School’s Seidman Lab.

Only 14 people have ever been born with this gene, and five have died from it — every one of them is a member of my family. The gene manifests itself in adulthood, and the youngest person to die from it was my great-uncle Nathan, at age 34.

Little is known about our genetic mistake. I am part of the fifth generation of carriers, and the seven of us who are left in a race against time to find a cure.

I first witnessed the awful power of our family gene in 1991, when I was 16. My older sister Hilary and I were watching TV downstairs when we heard a thud. We ran upstairs.

Our father was on the floor, a gash on his head and blood spewing down his face.

Our dad had fallen head first into the banister. He had taken a pill for some light swelling in his legs, and when he stood up quickly from his nap had become woozy and passed out. I didn’t know my father had been taking pills for swelling; I didn’t know his body had been swelling.

We took my father, a physician, to his nearby office, where he was given 11 stitches and sent on his way. But solving the bigger riddle of his illness would prove harrowing.

A family doctor in Middle America, Dad was the kind of man whose patients named their children William after him. When he had to relay news of a dire illness he’d say, “Look, we’ve seen this before and someone, somewhere has survived this.”

Unfortunately, his own doctors couldn’t tell him the same.

Two years after he fell, he was at work and found he couldn’t breathe. An ER doctor put a tube into his chest. Suddenly, out gushed a fluid, the color of lemon meringue pie with the consistency of a milkshake.

We had spent years looking for any answer, and all along they were right here in our family tree

“What the hell is that?” his co-worker Kim asked.

The fluid was lymphatic exudate, or pure lymph. When lymphatic fluid leaks, it is almost always a symptom of something going very wrong, most typically with the heart or liver. But after extensive testing, doctors found nothing wrong with my dad.

His organs were strong; heart and liver disease, cancers and everything else were ruled out.

As my dad’s condition worsened over the next year, exploratory procedures caused catastrophic infections. Intensive-care units around the country became second homes.

One day, Dad was in the hospital again, surrounded by family, when my great-aunt Joanie showed up, clutching an old medical file from the 1960s. Her husband, Nathan, had died in 1961 at the age of 34. Uncle Nathan was my father’s uncle. His mother’s brother.

“Just look at Nathan’s chart,” Aunt Joanie said.

I looked inside the folder. At 21, I was old enough to understand its relevance. We had spent years looking for any answer, and all along they were right here in our family tree. My father was following in his uncle’s footsteps beat for beat — from the lymphatic fluid to the long hospital stays without any answers. But Nathan had died before anyone knew the reason.

Joanie also brought notes from the chart for Nathan’s mother, Mae, a Brooklyn native who had become sick in the 1930s and finally died at the age of 55 in 1954 of something that seemed suspiciously similar to the ailment afflicting her son — and now her grandson.

It was a “eureka moment.” Even if the outlook wasn’t great, we had our first clues.

Doctors passed my father’s medical chart around his growing team of doctors, which now spanned three states. Dr. Christine “Kricket” Seidman, a young superstar genetics researcher from Harvard showed up with a team and promised to help us.

In September 1996, my father died at age 49. One of the doctors who performed his autopsy told us that the years of fatty lymph pooling in his body cavity had left my father’s organs practically fused together.

Dr. Kricket flew our family members from around the country to her lab to test her theories. Based on three people, my great-grandmother, my great-uncle and my father, Dr. Kricket identified two key facts: The swelling of the limbs also occurred in healthy family members, including my father’s 73-year-old mother and 72-year-old aunt; and the illness looked strikingly different in the one woman — my great-grandmother Mae — who apparently had died from the disease.

That second point was crucial to Dr. Kricket’s theory. Whereas my father and his uncle had both been young men with sudden onsets that took their lives in under four years, my great-grandmother’s illness was long and slow, beginning in 1938 with a swollen arm and ending with her death in 1955. She died of infection; the men of starvation.

From these facts, she reached a valuable conclusion: The condition was linked to the X chromosome.

Women have two X chromosomes (called XX), while men are XY. For women, having a second X means their bodies have additional healthy information that can temper the bad.

Dr. Kricket also identified another shared symptom: a functional heart murmur. This, she decided, was how she could test the other members of my family for the gene.

In 1997, my sister and I — ages 23 and 22, respectively — arrived at Brigham and Women’s Hospital in Boston, where Hilary and I separately underwent ultrasounds, a wand pressed tightly into our ribs, seeing our hearts beat on a monitor.

“There it is,” Dr. Kricket said, noting a telltale murmur as the sound of my heartbeat filled the room.

It was conclusive. I had the gene.

When Hilary joined me after her test, I could tell from her dejected face that her result was the same.

Dr. Kricket took one of each of our hands before we left. “You girls will never have what your father had,” she said, meeting our nervous eyes with her serious ones. “Remember your beautiful grandmother?” she asked. Our father’s mother, Shirley, was alive and well and nearing 80, despite also having the gene. “Think of her.”

It wasn’t a promise. But it was hope, and we chose to believe it.

Dr. Kricket looked everywhere she could to find answers about our disease. Every lead was a dead end. She came to the realization that our illness was a fluke — a “genetic orphan,” a new variant that was unique to our family and only five generations old.

Illnesses caused by a single gene are rare enough, but to identify one at its beginning was an entirely new phenomenon.

Cystic fibrosis, which is also a single-gene disease sparked by one tiny genetic mistake, has been passed down through more than 2,600 generations over more than 52,000 years. It now has hundreds of thousands of carriers.

If our gene began with my great-great-grandmother, a woman named Ester Bloom who lived to be 80 but whose pictures reveal the telltale symptom of swollen legs, then it was only 100 years old and five generations deep — with only seven living carriers. (Two other carriers died later in life, and the gene wasn’t named as the cause.)

The years passed and my hopes faded. By the time I was 27, I was living in San Francisco, directionless and depressed, the weight of a possibly lethal diagnosis looming over me. My ankles had recently begun to swell, just like my grandmother who also started swelling in her 20s. Although I largely hid out in my apartment in a miserable relationship, playing computer video games and binge-watching “Sex and the City.”

Back home in Ohio, Hilary was dating like it was a mission, desperate to have kids as she neared 30. It remained unspoken that those children had a 50/50 chance of being born with an X chromosome that could kill them.

Meanwhile, Dr. Kricket continued to remind us that our great-aunt Norma, who had died at age 75, had lived a full life with the disease. “You will not get what your father had,” she repeated by phone whenever we called with our concerns.

Then something remarkable happened. In 2003, when I was 28, the Seidman Lab mapped our gene, identifying the exact protein culprit in our DNA. It meant that future members of our family would not have to be born with the orphan gene, as long as embryos are tested for it before being implanted through in vitro fertilization.

“When you are ready to talk about having kids,” Dr. Kricket told Hilary and me, “call me.”

Hilary was the first to call, after her marriage to Brian, a landscape architect, in 2005. She had the procedure, and in 2008 my healthy and gorgeous twin niece and nephew, Addison and Billy, were born, free from our family disease.

I improved my outlook through therapy and focusing on the future. My slightly swollen ankles were the only sign of my disease. I moved to New York, got a job working for an indie production company and started writing.

One night, I was at a Brooklyn bar for a friend’s birthday when I saw a tall blond man smoking a cigarette in the courtyard. Throwing caution to the wind, I decided to follow him to the bathroom line.

“Where are you from?” he asked me, with a voice deep and friendly enough for radio.

By the time I was 27, I was living in San Francisco, directionless and depressed, the weight of a possibly lethal diagnosis looming over me

“Ohio,” I answered.

“Me, too!” he said.

Aaron and I started dating. On our fourth date, I told him about my family gene and to my amazement he didn’t get spooked.

“It’s not a deal breaker,” he told me.

Four years after we met, we got engaged.

At the same time, I was 34 and my gene was poised to deal an ugly blow.

Flying to Ohio for a visit back home, I realized that my foot had doubled in size and was throbbing painfully inside my shoe. Try as I might, I couldn’t get my leather clog to slide off. I raced to Walmart, down the shoe aisle and grabbed a roomy pair of work boots two sizes too large. I went to the school-supplies section for heavy scissors, sat on the floor and cut into my shoes until I could excavate my foot.

Both my foot and leg had swelled with fluid.

I didn’t panic. And when I returned to New York, I just shut down. While my fiancé begged me to get my leg checked out, it took me six months to gather the courage to see Dr. Kricket.

After an MRI, she sat me down and broke the news.

“You have a blockage in a main pathway of your liver — the portal vein.”

A cousin on my father’s side named Valerie had the exact same complaint.

She had almost died of a stroke at 58 and was still recovering.

A few months later, in July 2011, Aaron and I arrived at the Jiminy Peak ski resort in the Berkshires for our wedding. The adorable white ankle boots I had picked out to wear for the ceremony no longer fit my swollen foot. In its place, Aaron found a pair of hideous-but-comfortable Velcro shoes, which he placed like glass slippers on my feet.

“Your dress will cover it,” he assured me.

My sister and her 2-year-old twins walked down the aisle. Valerie, now almost completely recovered from her stroke, came, as did every other family member carrying our gene. The symptoms for everyone are different. Some share my blocked portal vein, including my sister and another cousin in our generation. Others share the swelling. But, at that moment, I felt the strength of us all being in it together.

After the wedding, I underwent a procedure to reopen my blocked vein. Unfortunately, the procedure failed, and I was upset, not only because the

ailment will continue to pose a greater risk to my health in the future. It also complicates my ability to carry a child, even with gene-tested embryos free from the disease.

At the follow-up appointment, with Aaron at my side, I asked my doctor, “Can we have children?”

He shrugged and gave a blunt reply, “I wouldn’t.”

Aaron took my hand and kissed me.

“It’s a good thing we love dogs,” he said.

At that moment, I couldn’t have loved him more.

Today, we are happily married and leading a happy and productive life. Right now, all the carriers are still alive and waiting for a cure, which Dr. Kricket still believes we will find in our lifetime. We are thrilled that, so far, no one in the sixth generation of our family — 23 children in all — has been born with the gene.

But, in the meantime, I’m still a ticking time bomb.

There are days I have to force off my fears in order to get out of bed.

And there are other days when I know that being this near death reminds me how much I love life. It makes every part of every day something I am joyously grateful for.

Sometimes I think that — if my life is long — having spent it with this kind of awareness, and everything I know about my body, will have been a gift.