The man, who was identified as a German national in his fifties with no fixed abode, was found dead near a train station in Hässleholm, southern Sweden, in August last year. He had been stabbed three times.
A 17-year-old boy was arrested a week later on suspicion of murdering him. But on Friday Hässleholm District Court found that it had not been proven he was ever at the scene.
The police have not been able to find the weapon that was used to kill the homeless man, and there is no other forensic evidence linking the teenager, who is now 18, to the crime.
The court did however order the young man to pay a fine for a minor narcotics offence and for threatening another man earlier the same evening.
Prosecutor Malin Pålsson had urged the court to sentence the man to four years' detention in a closed facility for juvenile offenders.
“I've felt that I've been able to give good reasons for why he should be convicted of the crime. Then of course you could always make different assessments of the same material, but I will have to read the ruling and then consider whether or not to appeal it,” she told TT.