A New York judge asked lawyers for the Trump Foundation on Thursday about the organization's involvement with a highly publicized fundraiser hosted by President Trump in Iowa when he was a candidate in January 2016.

The event, which was held the same night as a Republican primary debate that Mr. Trump skipped, is the focal point of a lawsuit filed in June by the office of New York Attorney General Barbara Underwood. The suit accuses Mr. Trump of having used his private foundation as a campaign tool during the 2016 presidential race and to settle legal claims for his businesses in the past.

The lawsuit alleges that the Donald J. Trump Foundation was operated by its directors, three of whom are Mr. Trump's children Donald Jr., Eric and Ivanka, as a "shell corporation that functioned as a checkbook" for the Trump campaign and businesses.

Get Breaking News Delivered to Your Inbox

Soon after the lawsuit was filed on June 14, Mr. Trump insinuated in a tweet that the case was a politically motivated filing by "sleazy New York Democrats."

His attorney, Alan Futerfas, argued similarly in a motion to dismiss the lawsuit filed in August.

Futerfas wrote that former New York Attorney General Eric Schneiderman, who resigned in disgrace in May, "solicited financial donations to his own campaign for re-election based on his promise to 'lead the resistance' and attack the President and his policies, describing the President as out to 'hurt' New Yorkers."

At a hearing in Manhattan on Thursday to hear arguments on the motion to dismiss, New York Supreme Court Justice Saliann Scarpulla appeared skeptical of Futerfas' political bias claims.

"It's not something that's really of interest to me," he said, adding later, "I don't want to get involved with that."

"The allegations are what they are," Scarpulla said.

The Trump Foundation is accused of giving control of money raised during the televised Iowa fundraiser — held during a debate that Mr. Trump skipped — to his campaign, which would be a violation of New York laws governing how private foundations operate.

During the hearing, Scarpulla questioned Futerfas about whether the fundraiser was a campaign event.

"During that fundraiser, did he speak about his campaign?" she asked. Futerfas replied, "Yes."

"So it wasn't just a fundraiser," Scarpulla observed, saying it was also a political event.

"He was certainly there as a candidate. Let's put it that way," Futerfas said.

That same month the foundation's treasurer Allen Weisselberg emailed then-Trump campaign manager Corey Lewandowski, writing, "we should start thinking about how you want to distribute the funds collected." Weisselberg is also chief financial officer of the Trump Organization.

A private foundation's charitable giving is typically controlled by its board of directors, who are required by New York law to meet regularly, as Scarpulla noted during Thursday's hearing. In its lawsuit, the attorney general's office said Donald Jr., Eric and Ivanka never held any board of directors' meetings.

"Even if they are doing spectacularly good work, they are still required to follow the law," Scarpulla said.

Scarpulla said Thursday she'll reserve judgement on the motion to dismiss until a ruling is made in a different New York court on whether a defamation case against Mr. Trump brought by former Apprentice contestant Summer Zervos can proceed. Zervos claimed in 2016 that Mr. Trump forcibly kissed and groped in December 2007. She sued after Mr. Trump called her and a dozen other women who made sexual misconduct allegations against him "liars."

In that case, Mr. Trump's lawyers have argued that the Constitution's supremacy clause prevents a sitting president of the United States from being sued in state court. A finding in Mr. Trump's favor in the Zervos dispute would almost certainly put the attorney general's case, which is also filed in state court, in peril.

The Zervos dispute hinges on the landmark 1997 case Clinton v. Jones, in which the Supreme Court ruled a sitting president has no immunity in federal court from civil law litigation for actions taken before taking office.

Whether that decision applies to state courts has yet to be determined.