The UN refugee agency said it had evacuated the refugees, including women and children, from the Abu Selim detention centre in south Tripoli, to its Gathering and Departure Facility (GDF) in the centre of the capital.
The operation came as fierce fighting continued between forces loyal to warlord Khalifa Haftar and those backing the internationally recognised Government of National Accord (GNA).
"It is a race against time to move people out of harm's way," UNHCR's Assistant Chief of Mission in Libya, Lucie Gagne, said in a statement.
"Conflict and deteriorating security conditions hamper how much we can do," she said.
At least 174 people have been killed and 758 wounded in the battle for control over the Libyan capital which has rocked Libya since Haftar launched his offensive on Tripoli earlier this month, the World Health Organization said on Tuesday.
Abu Selim is one of several detention centres that have been impacted by the clashes.
UNHCR, which last week evacuated more than 150 refugees and migrants from the Ain Zara detention centre, said it had planned to evacuate more people on Tuesday but had been prevented from doing so by a rapid escalation in fighting in the area.
The refugees evacuated on Tuesday were "petrified and traumatised" by the fighting and feared for their lives, UNHCR said.
The agency's staff who organised the evacuation on the ground said the clashes were around 10 kilometres away and were clearly audible, according to the statement.
"We urgently need solutions for people trapped in Libya, including humanitarian evacuations to transfer those most vulnerable out of the country," Gagne said.
UNHCR said there were now more than 400 people currently being hosted at the GDF, but that more than 2,700 refugees and migrants remained detained and trapped in areas where clashes were ongoing.
The UN agency stressed that the current conditions in Libya "underscore the fact that (the country) is a dangerous place for refugees and migrants."
"Those rescued and intercepted at sea should not be returned there," UNHCR said, also reiterating its call for an end to the detention for refugees and migrants.
Follow us on Twitter: @The_NewArab