Under Iraq's anti-terrorism law, courts can sentence to death anyone found guilty of belonging to Isis, including non-combatants.
Victoria Lazar, a Swede of Serbian origin in her late 20s, was acquitted of the charge “for lack of sufficient evidence”, the judicial source told AFP.
But she was sentenced in a separate case to six months in prison for illegally entering Iraq, the source added.
During questioning, Lazar had told interrogators she had come to Iraq with her husband and their three children, now aged five, four and three.
She said her husband had been killed in 2016 during bombing of Tal Afar, near Mosul in the north of the country.
More than 300 people, including around 100 foreigners, have been sentenced to death and many others to life imprisonment in Iraq for joining Isis, the Sunni extremist group which at its peak controlled nearly a third of the country.