Both in their early 20s, James Mwape and Philip Mubiana have been held in custody since May 2013 and faced 15 years behind bars if convicted.
The pair’s lawyer William Ngwira said it was a “welcome” ruling, but added: “We are only sad that our clients have been in detention for over a year.”
The two men were apprehended after being reported to the police by one of Mubiana’s family members.
Their case drew the attention of rights groups and governments who were concerned that Zambia was following Uganda and other African countries in its harsh crackdown on gay rights.
Zambia’s tough anti-homosexuality laws date back to the British colonial era and public opinion remains strongly against gays and lesbians.
Outside the court in Kapiri Mposhi, 200km north of the capital Lusaka, several local residents chastised Western governments for supporting the couple.