WASHINGTON—The Trump administration threw the census into further confusion Wednesday, telling two federal judges that the government was seeking a legal basis to reinstate the citizenship question halted by the Supreme Court, a day after Justice Department lawyers said they dropped a plan to include the question.

“We at the Department of Justice have been instructed to examine whether there is a path forward, consistent with the Supreme Court’s decision, that would allow us to include the citizenship question on the census,”...