It was a school once, but there are no children here any more. The lonely building on this remote Pacific island now contains only a punchbag that someone has strung from the classroom rafters, and a note scrawled on the chalkboard in Niuean: “Keep this place clean so it stays beautiful.”

While much of the world worries about how it will accommodate rapidly growing populations, some islands in the Pacific face the opposite dilemma: how to stop everybody from leaving.

The population decline on Niue, a lush coral atoll, has been steady and relentless. In the 1960s, there were more than 5,000 people living here; today, there are fewer than 1,600. Fifteen times as many Niueans, some 24,000, now live across the ocean in New Zealand, 1,500 miles (2,400km) away.

The stories, songs and language that developed into the Niuean culture over more than 1,000 years are at risk of vanishing.

Speedo Hetutu, 54, attended the old school in the town of Avatele before it was abandoned and later used for workouts. There used to be six primary schools on the island; now there is only one. Other buildings where people used to work, pray or live now sit empty and in disrepair.

“People wanted to go away to look for a better life,” Hetutu says. “People are still searching.”

Other Pacific islands face similar struggles. The CIA estimates that the population of the Cook Islands is declining by 3% a year, a rate second only to war-torn Syria.

Children sing and clap at the Niue high school, near Alofi. Photograph: Nick Perry/AP Photograph: Nick Perry/AP

Tokelau and American Samoa are also losing significant numbers of people. Even on archipelagos such as Samoa and Tonga where the population is steady, people are abandoning the outer islands and moving to the main towns, where they can find better jobs, education and healthcare.

The exodus from Niue has been particularly acute because of its connection with New Zealand. Niue is self-governing but in free association with its wealthier neighbour to the south, and Niueans are automatically New Zealand citizens.

While that relationship has lured away thousands of young Niueans, it has also paid the bills for those who have remained. New Zealand has helped establish an NZ$50m (£26m) trust fund and gives annual aid that amounts to about NZ$11,000 per resident, helping fund the government work that accounts for most of the island’s jobs. Some Niueans living abroad send back remittances.

Many of those who left had goals that were simply too big for the island. Prof John Connell, a South Pacific expert at the University of Sydney, recalls talking to a nurse who specialised in neonatal care and had returned for her father’s funeral.

“There was no point in her being in Niue,” Connell says. “She could only be there if she was prepared to lose her high-powered skills, and she didn’t want to do that.”

Niueans see New Zealand as a land filled with opportunity, says the Rev Falkland Liuvaie, 52, a Presbyterian minister who moved to its capital, Wellington, seven years ago.

He delivers a weekly sermon in both Niuean and English which he says gives many expats their only opportunity to listen to their language. He says for the first few years he gave his services only in Niuean, until he realised many people had difficulty understanding him.

The oral traditions that were once strong on the island are in danger of disappearing, he says. He remembers as a young boy going into his grandfather’s bedroom at 5am, before he went to work, to hear him tell stories about fishing and working in the bush.

Roy Pavihi shapes a canoe in Avatele, Niue. Photograph: Nick Perry/AP Photograph: Nick Perry/AP

“It’s really hard. The more you stay away from home, the more you embrace other cultures, especially the western culture,” he says. “There’s nothing much you can do about it.”

Yet on Niue there is a sense of optimism, a belief that the exodus might finally be halting. That is thanks to more tourism money coming in and a renewed sense of national pride.

Roy Pavihi, 26, is part of a youth group that is learning to make canoes, using traditional tools such as chisels and modern ones such as electric planers. He works from a building near the old Avatele school, where it seems the roosters never stop crowing. He says he thinks the project is encouraging people to stay.

“We need to follow the skills of our forefathers,” he says. “Our village was renowned for fishing and canoes.”

It’s a way to keep the old knowledge alive, and comes with a bonus: catches of wahoo, tuna and mackerel for those who master the vessels.

One person who was never tempted to leave is Maihetoe Hekau. At 73, she remembers when families had little or no paid work, and instead tended their plantations, raising taro, tapioca and bananas.

A Niuean proverb has it that if you keep your bush knife sharp – or stay motivated – you will clear yourself a bigger plantation.

Children play at a former school in Avatele, Niue. Photograph: Nick Perry/AP Photograph: Nick Perry/AP

Although she attended high school in New Zealand, Hekau says she always loved the relaxed lifestyle on Niue, and decided it was the best place to raise a big family.

How big? She laughs, embarrassed to say. More than 10? Yes, she says, more than 10.

These days, she says, she uses a tablet computer to keep in touch with her children, most of whom live on the island. In 2003, Niue became the first country to offer all residents free Wi-Fi, one of several technological upgrades that islanders say make the isolation easier to cope with.

New Zealand is gradually reducing its aid to Niue, arguing that its contributions to the trust fund and its investments in tourism are helping the country become more self-sufficient.

This year, most Niuean government workers had their five-day work weeks reduced to four days at the same pay. The government says it helps people spend more time in their communities, while critics say it was because the budget is stretched and there was no money for promised raises.

The Niue premier, Toke Talagi, and his wife Fifitaloa. Photograph: Nick Perry/AP Photograph: Nick Perry/AP

The Niue premier, Toke Talagi, remains bullish about his country’s future.

“I know that some people tend to look at us and say: ’Well, you’re not viable,’” he says. “You need to define exactly what you mean by that. We were viable before anybody else came here. We were independent before anybody else came here.”

“Our task at the present moment is to use tourism to try to create opportunities so that people in New Zealand, or anywhere around the world that Niueans are living, will consider Niue again as a place for them to come back and live,” he says.

Niue government figures indicate about 7,000 people visited the island last year, double the number from six years earlier. Air New Zealand this year scheduled extra flights during the southern hemisphere winter tourist season.

The tourism director Vanessa Marsh says Niue attracts diverse groups from wedding parties to ham radio enthusiasts, who find the isolation reduces signal interference. Niue’s clear waters attract divers and sport fishermen.

Connell remains sceptical about the power of tourism to reverse Niue’s population loss. He says the island’s elevated, rocky coastline means it lacks the sandy beaches many holidaymakers seek. He says the tourists he met there tended to be people sailing the world, hardy backpackers or those trying to tick off 150 countries from their “bucket list”.

A coconut sits on the grass in Alofi, Niue. Photograph: Nick Perry/AP Photograph: Nick Perry/AP

Mark Blumsky, a former New Zealand businessman and politician who runs several tourism-related enterprises, is more optimistic. He moved to the island permanently after marrying a woman he met during a diplomatic posting there.

He says the lifestyle is remarkable. Take the jailhouse, located on one side of the golf course. The last inmate, in trouble for arson, spent his time tending the golf greens and improving his handicap before being released a year or two ago, Blumsky says.

He says there are stunning coastal walks, opportunities to see humpback whales and plenty of swimming holes.

It would be unusual, but not unprecedented, for an island’s population to simply pack up and leave. Connell says one of the more famous cases was St Kilda, off the west coast of Scotland, where in 1930 the last 36 islanders requested evacuation to the Scottish mainland.

He notes there are examples of places that have survived despite predictions they would not, including the Pitcairn Islands, home to about 50 people.

“It’s far too early to write off Niue,” Connell says. “But it has to be at risk.”