Prime Minister Viktor Orban said on Thursday that the lawsuit would be filed at the European Court of Justice in Luxembourg later that day.
"It is not enough to protest, action must be taken," Orban said.
The right-wing leader has long taken a hard line against the migrants, saying that the influx of so many Muslims posed a security threat and threatened the continent's Christian identity.
Hungary's legal challenge came just a day after neighboring Slovakia also filed a lawsuit against the mandatory quotas.
The lawsuit from Budapest followed a bill, passed by the Hungarian parliament last month, which obliged the government to challenge the EU quota.
Under the quota system, the EU plans to relocate 120,000 asylum seekers across the bloc's 28 member states, based on the population of each state. Budapest is expected to take in around 2,300 migrants.
Hungary's new legislation accuses the EU of ignoring the right of individual national governments to "express their opinion."
In September, when the quota system was agreed, Hungary, as well as the Czech Republic, Slovakia and Romania voted against the scheme. Their move highlighted a strong divide between western and eastern bloc members.
Almost 860,000 migrants have arrived in Europe so far this year, with many fleeing violence in Syria, Afghanistan and Iraq.
Over the summer months, Hungary became a key transit country for refugees traveling the western Balkan route to reach northern Europe. In October, however, it sealed off its southern borders with razor-wire fence.
Budapest's announcement on Thursday coincided with the launch of a scathing media campaign against the EU's quota scheme.
Hungary's national newspapers saw government-sponsored messages such as "The quota increases the terror threat!" and "An illegal immigrant arrives in Europe on average every 12 seconds."
Other messages read: "We don't know who they are, or what their intentions are" and "We don't know how many hidden terrorists are among them."
As part of the nationwide assault on the EU's plans, Budapest said billboards bearing the slogan "Let's defend the country" would be erected in the coming days.
ksb/jm (AFP, AP)