The activists had ran into the Thessaloniki cathedral on Sunday, scattering leaflets that read "Solidarity with the refugees", before they were taken into custody by anti-riot forces.
Among those arrested were nine foreigners from Austria, Britain, Germany, Morocco, Spain and Switzerland.
The Thessaloniki court threw out charges of "disturbing a religious gathering".
Bavaria leader rejects Merkel's stance of refugees
However, 19 of the activists were handed suspended six-month prison sentences for refusing to be fingerprinted by police.
The ruling is suspended over a three-year period.
The protest came after city authorities last week forced refugees out of three buildings where they had been squatting, including an orphanage belonging to the diocese.
An incendiary device was also set off earlier Sunday outside the company that demolished the orphanage. Nobody was hurt.
A number of abandoned buildings in Athens and Thessaloniki in recent months have been taken over by anarchists and groups helping migrants and refugees to find shelter.
Official estimates say more than 2,000 refugees are currently living in such squats, mostly former schools.
While the left-wing Greek government has been quietly tolerant of the squatters, local authorities have taken a harsher stance, warning of health and safety hazards.
Italy says 6,500 migrants rescued since Thursday
Ever since Balkan nations on the migrant trail closed their borders earlier this year, the Greek government has been struggling to cope with a build-up of new arrivals prevented from continuing their journey further north into Europe.
Greece is currently hosting some 57,000 people, mainly Syrian refugees.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ