The group, using the name Islamic State West Africa Province (ISWAP), said in a statement posted on social media that the bomber “was able to detonate his explosive vest in the area of Maiduguri”.
The group said the attack was carried out by Abu Anas al-Ansari.
It claimed “at least 15 apostates (non-believers)” were killed in the attack, which happened at about 12:00 pm (1100 GMT) at the Borno State Secretariat in the city.
But Nigerian Army spokesman Sani Usman said only two died and said the attacker blew up as security personnel stopped him from trying to get into the government offices.
“Unfortunately in the process of stopping him, he detonated the improvised explosive device on his body, instantly killing himself, a policeman and critically injuring another policeman…
“Sadly, the injured policeman died later,” Usman said in an emailed statement, adding that 18 people were injured and taken for treatment.
Mohammed Kanar, regional coordinator for the National Emergency Management Agency, and an accident and emergency spokesman for the Borno State Specialist Hospital, also confirmed just two deaths.
Between 19 and 24 people were injured in the blast, they added.