GREENBELT, Md. — A federal judge on Monday sharply criticized the Justice Department’s argument that President Trump’s financial interest in his company’s hotel in downtown Washington is constitutional, a fresh sign that the judge may soon rule against the president in a historic case that could head to the Supreme Court.

The plaintiffs in the lawsuit, the District of Columbia and the state of Maryland, charge that Mr. Trump’s profits from the hotel violate anti-corruption clauses of the Constitution that restrict government-bestowed financial benefits, or emoluments, to presidents beyond their official salary. They say the hotel is siphoning business from local convention centers and hotels.

The judge, Peter J. Messitte of the United States District Court in Maryland, promised to decide by the end of July whether to allow the plaintiffs to proceed to the next stage, in which they could demand financial records from the hotel or other evidence from the president. The case takes aim at whether Mr. Trump violated the Constitution’s emoluments clauses, which prevent a president from accepting government-bestowed benefits either at home or abroad. Until now, the issue of what constitutes an illegal emolument has never been litigated.

Attorneys general for the District of Columbia and Maryland say that by allowing foreign officials to patronize the five-star Trump International Hotel blocks from the White House, Mr. Trump is violating the Constitution’s ban on payments from foreign governments to federal officeholders. They also claim the president is violating a related clause that restricts compensation, other than his salary, from the federal government or from state governments.