Six ISIS-linked Boko Haram members were arrested for the planned attack last month, the Department of State Services (DSS) said.
"The group had perfected plans to attack the UK and American Embassies and other western interests in Abuja," DSS official Tony Opuiyo said in a statement.
The men were arrested March 25 and 26 in Abuja and central Benue state, Opuiyo added. Another man was previously arrested, on March 22, in north-eastern Yobe state, the DSS said. That man confessed to being part of the group, officials said.
In 2011, Boko Haram killed at least 21 people in a car bomb explosion at the UN headquarters in Abuja.
A UK Foreign office spokeswoman said the UK is "grateful for the support we receive from the Nigerian security authorities in protecting UK diplomatic staff and premises in Nigeria."
"We are in regular contact with the Nigerian security authorities concerning potential threats to UK interests in Nigeria," the spokeswoman said.
The United States "appreciates the work of Nigerian security forces in fighting terrorism and keeping citizens and residents safe," a spokesman for the US Embassy said.
"Nigeria and the United States continue to have a strong partnership in combating terrorism."