A vote was promised by Prime Minister Jacinda Ardern's Labour Party last year during cross-party talks, which helped to form a coalition government.
It comes a week after lawmakers gave medicinal cannabis the green light.
An opinion poll last year suggested two thirds of New Zealanders favoured legalisation.
"We know when it will be, we have a commitment that it will be binding, and now it is just a question on filling in the detail from there," said Justice Minister Andrew Little, following a decision by the country's cabinet on Monday.
Until now, Prime Minister Jacinda Ardern had avoided committing to a non-binding agreement.
Her left-wing Labour Party is part of a three-way coalition government, with the Green Party and populists New Zealand First (NZF). The partnership was formed after inconclusive elections last year led to a hung parliament.
The Greens have welcomed the referendum decision.
"We've had countless opinion polls for decades now, confirming New Zealanders are positively well ahead of political action on the issue of cannabis law reform," the party's spokesperson Chloe Swarbrick said in a statement.
"This binding referendum presents an opportunity to have the will of the people trigger meaningful legislative change," she added.
However the National Party leader, Simon Bridges, called the vote a "cynical" move to distract voters from other issues around the general election.
Medical cannabis: Death sentence prompts Malaysia to re-think harsh laws Mr Bridges also said legalising cannabis would normalise drug use.
Cannabis is the most commonly used illicit drug in New Zealand, according to the NZ Drug Foundation.
The charity says that by the age of 21, 80% of New Zealanders have tried cannabis at least once, whilst 10% had developed a pattern of heavy use.
A vote in favour of legalisation would make New Zealand the first Asia Pacific country to allow its recreational use.
Cannabis is widely prohibited throughout the world, but recreational use has recently been legalised in Canada and Uruguay.