Apollo House has been occupied since the end of last week
A judge has granted an injunction directing occupiers of Apollo House leave the building.
They have until January 11th to vacate the building.
Mr Justice Paul Gilligan said it was clear that the Home Sweet Home group were motivated by a genuine concern for the plight of the homeless, but he had to consider the fact that they’re clearly trespassing.
He said he wasn’t satisfied that what they described as “exceptional circumstances” would justify any other decision in relation to the order.
But he did allow them to stay until noon on January 11th as long as they abide by certain conditions, including a cap on the numbers allowed in.
It comes after a Dublin City Council official has assured the High Court they can cater for the 40 homeless people who are illegally occupying the building.
The assurance was made in a sworn statement read out as part of the application for a court order to have them removed from the building.
The occupants are refusing to leave because they claim they have nowhere else to go.
In his sworn affidavit, Dr Dáithí Downey, Director of the Dublin Region Homeless Executive, said the occupants of Apollo House wouldn’t be forced onto the streets because the council has sufficient capacity to serve.
An issue about the suitability of alternatives was raised earlier, with one woman describing them as “unsafe” for vulnerable users.
The receivers have repeatedly said they do not want to render anyone homeless, and have concerns about the safety of the derelict building.
Earlier, the High Court heard that the Home Sweet Home campaigners do not believe there are enough beds in Dublin city for the homeless.
The musician Glen Hansard was among four of the campaigners challenging an application for an order to have Apollo House vacated.
Ross Maguire, who is representing Mr Hansard and three other Home Sweet Home campaigners, told Mr Justice Paul Gilligan the consequence of a court order to vacate Apollo House would "unreasonably" render the occupants homeless.
This claim was dismissed by Rossa Fanning, who is acting for the NAMA appointed receivers.
Mr Maguire said his clients "roundly rejected" the contention there is no shortage of beds for those who do not have a home of their own.
He also said all of their health and safety concerns have been addressed.
Apollo House, a ten-storey derelict building on Dublin's Tara Street, has been occupied by Home Sweet Home volunteers and up to 30 homeless people since the end of last week.
The receivers have moved to assure the occupants that they do not want to see anyone spending Christmas on the streets.
Sinn Féin MEP Lynn Boylan says the protesters should not leave - even if the court orders them to.
"How could you say that they're going to be safer out on the streets over Christmas in the freezing cold weather than they are in Apollo House?
"People have said this is a temporary measure once they know that those beds are in place they're prepared to stop.
"But what we've seen on Facebook - when you compare the photographs of mats on a floor - compared to what the standards are in Apollo House, I think everyone would say that what Apollo House is offering the homeless if far superior".
Around 200 protesters gathered outside the court earlier.
One woman said she has experienced homelessness, and that is why she turned out to support the occupiers of Apollo House.
"Well if February this year I was evicted from Mountjoy Street and the Irish Housing Network got behind me so I'm here to support them today.
"(Apollo House protesters should) stand their ground - we stood our ground in Mountjoy Street and most of us got sorted.
Asked if she thought the argument that the building is unsafe was valid, she replied: "No. Some of the places I've been in, they weren't safe but we were still left there" she added.
Earlier, Housing Minister Simon Coveney told reporters there were sufficient emergency beds in Dublin for anyone sleeping rough who needs one this Christmas.
And he said Apollo House is not the answer as it does not provide all the support services that people need.
"I don't think that it's a solution for people who are homeless to actually be accommodated in a building that's probably not suitable for that. "I don't know cause I haven't visited Apollo House.
"But really where I want vulnerable homeless people to be is in the care of organisations like the Simon Community, like the Peter McVerry Trust, like Focus Ireland, like Vincent de Paul that have the experience and professionalism to deal with the complexity of supporting homeless people".