Law Minister Anisul Huq and Attorney General Mahbubey Alam were also present.
The prime minister entered the Bangabhaban after 7pm on Thursday.
Law Minister Huq had arrived before her.
Hasina’s motorcade left at around 10pm.
The gathering of the heads of the State, government and judiciary came when Chief Justice Sinha’s warning against the writing of judgments by judges after their retirements has sparked debate.
The BNP and lawyers loyal to the party are claiming the cancellation of the caretaker government system is illegal as it was done following a verdict written after the judge’s retirement.
The Bangabhaban and the Prime Minister’s Office kept the media in the dark about the dinner.
The law minister told bdnews24.com they had gone to the Bangabhaban at the president’s invitation.
“There was nothing else about it,” he said.
Attorney General Alam also said they only responded to the president’s invitation.