Taiwanese-Canadian businessman Joseph Tsai bought the Brooklyn Nets for a record price — despite the fact that the team had the worst attendance in the NBA last year.

It’s a gamble — but one that Tsai could win, experts said.

Tsai, the co-founder and vice chair of Alibaba, became the new owner of the Nets on Friday in a deal that cost $2.35 billion over two years— the most ever paid for a sports team.

The median value of an NBA team today is about $1.75 billion, sports bankers said, which means Tsai paid a hefty premium even though the Nets barely make a profit.

Tsai, 55, went forward with the deal anyway because he wanted a New York City team and it was the only one for sale, a source familiar with his thinking said.

“Billionaires want to live in New York, Los Angeles or South Florida,” the source said, adding that the location of the team will also help Tsai if he were to sell.

Tsai is also banking on the NBA’s international growth, especially in China where he has deep ties, sources said.

In just one sign of how hot China is getting for the NBA, tech company Tencent Holdings last month announced a five-year expansion of its existing digital media partnership with the basketball league. And it agreed to pay $1.5 billion for the rights — or triple the previous price of $500 million, a source said.

China’s demand for the NBA — and the Nets specifically — could grow exponentially if Tsai were to recruit a Chinese player, which he has said he wants to do. “I think it’s just a matter of time,” he told Netsdaily.com in May.

Tsai’s purchase also comes as the Nets are poised to become a more popular team in their own backyard — thanks to their newly inked contracts with NBA All-Star free agents Kyrie Irving and Kevin Durant.

The Brooklyn team has been projecting that revenue for the upcoming season will pop by 10 percent to 15 percent before Durant, its biggest new star, even makes it onto the court, The Post reported last month.

The Nets signed Durant for $164 million despite an Achilles tendon injury that could sideline him for a year.

The risk is that the Nets continue their losing streak if Durant does not return to his former self, which would also leave the team cash-strapped and further hinder the team’s ability to grow its fan base, sources said.

“If the Nets are bad and the Knicks become good no one would care about the Nets,” which has been the case in many of their seasons, one expert said.

“There is very little brand equity in the Nets,” this person said of the team, which only moved to Brooklyn in 2012. Prior to that they had been the New Jersey Nets.

If Tsai loses money on the Nets, it could really hurt as the total cost of the transaction is roughly one-third his estimated net worth of $9.4 billion.

In addition to the team, Tsai also forked over $700 million for the Barclays Center arena, the Nets’ home since they moved to Brooklyn. Because the arena also comes with $325 million in debt, the total cost to Tsai sits at $3.38 billion, according to a person with knowledge of the transaction.