A number of fighters attacked the base in the town of Rann in Borno state late on Thursday but were pushed back by armed forces after a gunfight.
The attack resulted in the death of two aid workers and a medical doctor who worked in a nearby camp hosting about 55,000 internally displaced persons.
“We call on authorities to ensure the perpetrators are brought to justice and account,” Edward Kallon, the UN Humanitarian Coordinator in Nigeria, said in a statement.
Al Jazeera’s Mohamed Vall, reporting from Abuja, said the attack was aimed at the military post guarding the camp.
“According to the UN source, two of them [aid workers] had been working with the International Organisation for Migration (IOM), and one was a medical doctor with UNICEF,” he said
“A fourth worker, whose identity has not yet been established, is also suspected to have died and another one was apparently abducted.”
In January 2017, the camp was accidentally bombed by a Nigerian military fighter jet, killing up to 170 people.
The attack comes shortly after the group abducted 110 girls from a school in the town of Dapchi, west of Rann, a major setback for President Muhammadu Buhari who had vowed to improve security and defeat Boko Haram.
Borno state is the part of Nigeria that is worst hit by the Boko Haram attacks, which have continued despite repeated assertions by the government and military since 2016 that they had defeated the armed group.
Boko Haram roughly translates to “Western education is forbidden”.
More than 20,000 people have been killed, and over two million have been forced to flee their homes since 2009 when the group waged an armed campaign in northeastern Nigeria.