The extraordinary ruling, in the capital, Lusaka, means Mr Kaunda, aged 74, is likely to be charged with having illegally run Zambia for 27 years until 1991. According to the decision, he was an alien while president of the former British colony.
His son, Major Wezi Kaunda, said the former president would appeal to the country's supreme court. "The ruling is part of the governing party's campaign to get rid of him,'' he said.
In a private citizen's petition, Judge Chalendo Sakala ruled that Mr Kaunda, who was born in Zambia of Malawian missionary parents, was neither Zambian nor Malawian.
The judge said: "He is indeed a stateless person. I grant the prerogative order of certiorari [ordering the review of a lower court's decision] sought by the applicants and order the Citizenship Board of Zambia to quash Kaunda's citizenship."
Zambia is in crisis caused by a heavy foreign debt burden and low world prices for copper, of which it produces more than any other African country. But the southern African country's judiciary has always been reputed for its impartiality.
Since President Frederick Chiluba, a former trade union leader, succeeded Mr Kaunda in 1991 the two men have played a cat-and-mouse game. Mr Kaunda, known as "Super K", is generally seen as more popular than "Hefty Jay" (F T J Chiluba).
On Christmas Day in 1997, Mr Kaunda was arrested for having knowledge of a coup attempt by renegade soldiers. After months under house arrest, he was cleared.
The previous year, President Chiluba's Movement for Multi-Party Democracy changed the constitution to prevent Mr Kaunda from standing in the 1996 presidential election.
President Chiluba is currently facing sharp criticism from Angola, Zambia's neighbour in the west, whose government accuses it of turning a blind eye to shipments of arms across its territory to the Unita rebel movement.
This led a well-respected Lusaka newspaper, The Post, to publish a story in which it was claimed that Zambia had insufficient arms to defend itself against an Angola attack. Six journalists were arrested for the story.
In their appeal against yesterday's judgment, the former president's lawyers are expected to cite the case of President Chiluba who frequently faced claims that he was born in Malawi. He recently quashed those claims using a 1973 supreme court ruling that any Commonwealth subject who had lived in Zambia for 10 years was entitled to citizenship.