Maria DeTommaso had little idea her life would change forever when she knocked on the door of a Long Island City building to watch a friend’s cat in 1993.

That’s when the twice-married yoga enthusiast became friends with Nicholas DeTommaso, a colorful retired dock worker who often cooked Italian meals for his neighbors in his rent-controlled railroad flat on the first floor of a dilapidated six-unit town house.

“I was living upstairs, and one day around Easter, he called me for breakfast,” DeTommaso told The Post. “He had decorated the apartment, and he made french fries and eggs.”

Maria, who was then known as Prema Deodhar, lingered over the meal, enchanted with the man everyone called “Nicky D” and “Uncle Nicky.” She never left.

Now, following a controversial death-bed adoption and nearly a decade of protracted court battles and wrangling with the building’s landlord, the state’s Division of Housing and Community Renewal said she can stay in perpetuity.

In a February ruling, the DHCR granted “succession rights” to DeTommaso’s cut-rate two-bedroom apartment.

“I’m very happy I won,” an ecstatic DeTommaso, 67, told The Post. “This apartment has good karma and I feel that Nicky loved me so much and totally protected me. Now it’s my home forever.”

DeTommaso pays just $100 a month for the ground-floor unit, located on an industrial stretch of the Hunters Point neighborhood. A similar two-bedroom unit in the building, which dates to 1930, was recently listed for $1,800 a month, according to the real-estate Web site StreetEasy.

“The reason I won is that I had to face some great obstacles and because I have such a big heart and I’m kind,” said DeTommaso.

But the owners of the town house disagree. Sugrim and Kowsila Outar, an elderly immigrant couple from Guyana who have owned the building since 1980, have described DeTommaso as a manipulator and nuisance who “tried all ways and means” to secure the apartment, ultimately persuading an invalid to adopt her as his daughter three weeks before he died in July 2009. Although Nicholas DeTommaso was briefly married, he had no children.

“We are frustrated,” said Sara Miros, a daughter of the owners who also lives in the building. “We just don’t understand how she was awarded a rent-controlled apartment like this.”

Exhausted by their struggles with DeTommaso, the Outars have put the 47th Road building on the market for $4.2 million, according to an online real-estate listing.

Part of their frustration has stemmed from the fact that for years Maria DeTommaso has sublet bedrooms to transients and now continuously has guests from around the world staying in her apartment, Miros told The Post. They pay $50 per night to stay at the flat which is crammed with colorful pillows and knickknacks and features a snowman toilet-seat cover, according to photos accompanying her ad on Airbnb. DeTommaso, who is legally entitled to rent the rooms on a short-term basis if she remains in the apartment, advertises herself as a congenial, yoga-loving host with “two cute little doggies Swani and Bambi.”

One Airbnb user commented that her place “looks crazy, but it has its charm!” Another called her ads “deceptive” and referred to the apartment as “unhygenic” — claims that DeTommaso vehemently denied.

She also denied becoming Nicky’s legal daughter for the purpose of getting the apartment. “I never had the intention of staying here, and I tried to move Nicky to a seniors building on the waterfront, but in the end he loved this place so much that I just couldn’t leave,” she said.

Nicholas DeTommaso lived in his flat for 85 years, until his death on July 15, 2009. A devoted “Star Trek” fan, he played stickball on the street when he was a child and chain-smoked cigarettes on the stoop, helping his neighbors secure parking spots when he was older, according to “Nicky D from LIC: A Narrative Portrait” by writer and artist Warren Lehrer.

“I know this building,” Nicholas DeTommaso told Lehrer. “I know each wire, I know every fuse, every crack in the wall. I can tell you where every leak on the friggin’ roof ever was and will be … I know the smelly hallways, its paper-thin walls. I know what spices are used in each apartment.”

Although it had been his dream to buy the building, Nicky continued to pay rent. “I could have bought this whole block for 20 grand, but I just paid rent,” he told Lehrer. “And what do I have to show for it? Receipts!”

Nicky worked as a longshoreman and spent years loading newspapers at the New York Times printing plant. He had five brothers and sisters, but “the family couldn’t stand to be around him for long because he had such a dirty mouth,” Maria DeTommaso told The Post.

When Maria DeTommaso met Nicky, her marriage to her Indian-born second husband — Anil Deodhar — was ending. Born Pamela Rose Becker on March 1, 1951, she had grown up in Washington, DC, and attended a series of posh private schools.

But by the time she moved in with Nicky in 2002, DeTommaso had long shed her socialite past. She said she doted on Nicky, whose health was in decline. She drove him around the city in a series of cars he bought for her, taking him on errands and visits to his doctors.

In 2007, Nicky granted DeTommaso power of attorney.

“Nick was like a piece of vegetable as he could not walk or talk or understand any commands,” wrote Outar in one of the many letters he addressed over the years to local and state authorities, including former Gov. David Paterson and a parade of DHCR commissioners. “His head was to his knees . . . it was a pitiful sight, and I felt sorry for him.”

Yet a month before he died, Nicky signed papers adopting then 58-year-old Pamela Becker/Prema Deodhar, who had already changed her name to Maria Nicola DeTommaso, as his daughter. The adoption was formalized on June 23, 2009, and DeTommaso became the beneficiary of his life insurance and pension, records show.

After Nicky died, the Outars had planned to rent his apartment for the market rate rent of $1,500. They told The Post they were shocked when they learned that Nicky had adopted his live-in companion, who informed them that she would “remain in the apartment for as long as I live.”

DeTommaso began setting up a tea house and yoga center and renting out rooms to homeless men, sometimes throwing them out in the middle of the night.

The Outars claim that she owes them nearly $200,000, but DeTommaso said she pays her $100 rent faithfully every month, placing it in an escrow account because the Outars refused to cash her checks, hoping to be able to evict her.

“The day after Nicky died, they’ve done everything to try to evict me,” she said. “I’ve endured a lot of harassment here, but no one can kick me out now. I’m a senior citizen now, and I plan to stay in my home forever.”

Asked what she would do if the building is sold in the future, DeTommaso said she would likely have to reevaluate her position. “It depends what they offer me,” she said.