Mr Assange has been living in the Ecuadorian embassy in London for more than three years and has been granted political asylum by the Ecuador government.
He believes he will be transported to the United States to be quizzed over the activities of WikiLeaks if he is extradited to Sweden. There is an espionage case against him in the US.
He filed a complaint against Sweden and the UK in September 2014 which has been considered by the UN Working Group on Arbitrary Detention.
The decision will be published formally today but it will be in Mr Assange’s favour, sparking calls for the UK and Sweden to release him.
Swedish prosecutors said the ruling will have no impact on its investigation, while the UK government will argue that it is an opinion rather than a legally binding decision.
Sweden’s foreign ministry confirmed that the UN panel will rule that Mr Assange has been the victim of “arbitrary” detention inside the embassy in the Knightsbridge area of London.
It is expected that the panel will say that the key elements of its decision include the inability of Mr Assange to access the benefit of political asylum, the fact that he has never been charged, the length of time he has been inside the embassy, and changes to UK law and procedures which have happened since he first arrived at the embassy.
The group of legal experts has made previous rulings on whether imprisonment or detention is lawful, which have led to people being released.
Mr Assange’s legal team is due to give a news conference in central London today shortly after the UN decision is confirmed.
They say the WikiLeaks founder would like to attend the conference in person, but it is more likely he will appear via a video link unless there is a sudden change of heart by the police and the UK government.
Mr Assange had said he would hand himself over to police for arrest today if the UN group ruled that he had not been unlawfully detained.
The Metropolitan Police have said they will make “every effort” to arrest the WikiLeaks founder should he leave the embassy.
Mr Assange is wanted for questioning in Sweden over one allegation of sexual assault, which he has always denied, and is fighting against extradition.
He was granted political asylum by Ecuador and has remained in their embassy since 2012.
Police have ended a 24 hour guard outside the embassy, but the building remains under covert surveillance.
A Metropolitan Police spokesman said: “The operation to arrest Julian Assange does however continue and should he leave the embassy the MPS will make every effort to arrest him.”