WASHINGTON — In a legal victory for the Trump administration, a federal judge dismissed a lawsuit on Thursday that accused President Trump of violating the Constitution by continuing to own and profit from his business empire.

The complaint, filed this year in the Southern District of New York, said that Mr. Trump’s failure to divorce himself from his businesses had harmed companies or workers who compete against his restaurants or hotels in New York or Washington. By taking advantage of his official position, the lawsuit said, Mr. Trump violated clauses of the Constitution that prohibit a president from accepting any government-bestowed benefits, or emoluments, either at home or abroad.

Judge George B. Daniels of United States District Court in Manhattan found that the plaintiffs had failed to show that they had suffered as a result of specific actions by Mr. Trump intended to drum up business for his enterprises. Even before Mr. Trump took office, the judge said, “he had amassed wealth and fame and was competing against” the plaintiffs.

“It is only natural that interest in his properties has generally increased since he became president,” the judge said. Moreover, Judge Daniels said, customers might be patronizing Mr. Trump’s hotels and his hotels’ restaurants because of price or quality — reasons totally unrelated to his presidency.