Many protesters wore orange jumpsuits intended to simulate prison garb.
Those arrested face a maximum penalty of 60 days in jail, a fine or both, for violating an ordinance that prohibits demonstrations of any kind on the grounds of the court.
Those arrested inside the building were charged under a provision that makes it a crime to give "a harangue or oration" in the supreme court building.
Officials briefly closed the court building during the protest.
The supreme court is considering whether prisoners still detained at Guantanamo Bay have a right to challenge their confinement in US courts.
Lawsuit dismissed
Earlier on Friday, a US court of appeal ruled that four former Guantanamo prisoners from Britain have no right to sue top Pentagon officials and military officers for torture, abuse and violations of their religious rights.

In Pictures:
 International outrcy
Through the Walls

In Video:
• Calling for closure

In Words:
The poets of Guantanamo 
• Sami al-Hajj - Prisoner 345

Shafiq Rasul, Asif Iqbal, Rhuhel Ahmed and Jamal al-Harith were released from Guantanamo in 2004 after being held for more than two years.
The three-judge panel from the District of Colombia Circuit rejected the law suit in which the former detainees sought $10 million in damages and named Donald Rumsfeld, the then US defence secretary as well as 10 military commanders.
The men claimed they were subjected to various forms of torture and were harassed as they practiced their religion.
The court cited a lack of jurisdiction over the claim and ruled that the defendants qualified for immunity for acts taken within the scope of government jobs.
"The alleged wrongful conduct was incidental to the defendants' legitimate employment duties," Judge Karen Lecraft Henderson wrote in the ruling.
Eric Lewis, the lawyers who argued the case for the detainees, vowed to appeal to the US supreme court.
"It is an awful day for the rule of law and common decency when a court finds that torture is all in a days' work for the secretary of defence and senior generals," Lewis said.
The prison, which has been widely criticised by human rights advocates, now holds about 275 prisoners.
George Bush, the US president has acknowledged the prison has damaged the reputation of the US and has said he would like to see it closed eventually.
Small demonstrations against Guantanamo Bay were also held in Rome; Prague, Czech Republic; Brussels, Belgium; and Budapest, Hungary.