Hungary will hold a referendum on 2 October on whether to accept mandatory EU quotas for relocating migrants, President Janos Ader has said.
PM Viktor Orban's right-wing government opposes plans to relocate a total of 160,000 refugees across the bloc.
The EU announced the scheme last year in response to the migrant crisis.
Analysts say Mr Orban is emboldened by UK's vote to leave the EU, after a campaign in which immigration was a key issue.
Hungary became a transit state on the Western Balkan route to Germany and other EU destinations.
In an effort to curb the influx, it sealed its border with Serbia and Croatia and criminalised illegal entry. The measures were popular at home but criticised by human rights groups.
In a statement, President Ader said voters would be asked: "Do you want the European Union to be entitled to prescribe the mandatory settlement of non-Hungarian citizens in Hungary without the consent of parliament?"
Hungary, along with Slovakia, has already launched a court challenge against the EU plan, which would see relocations over two years.
The proposal was meant to ease pressure on Greece and Italy, the main entry points for migrants and refugees into the bloc.
But its implementation has been slow. Until mid-June, 2,280 people had been relocated from both countries, none of them to Hungary, according to EU data.
Mr Orban has previously described the quotas as "illegal and unreasonable", saying they "could redraw Europe's cultural and religious identity".
More than one million migrants and refugees arrived in the EU in 2015, mostly by sea.