WASHINGTON — Not even a public scolding from Judge Neil M. Gorsuch could get President Trump to stop bashing federal judges.

Hours after Mr. Trump’s nominee for the Supreme Court declared during Senate confirmation hearings that he was “disheartened” about Mr. Trump’s unrestrained attacks on the judicial branch, the president was at it again, calling out the federal judges who have halted his second executive order banning travel from certain predominantly Muslim nations.

“Somebody said I should not criticize judges. O.K. I’ll criticize judges,” Mr. Trump said on Tuesday night at a fund-raising dinner for the National Republican Congressional Committee — reiterating his pique at a federal court judge in Hawaii who last week placed a stay on his second travel order.

Mr. Trump was in a loose mood after a day of wrangling votes for the House Republican leadership’s measure to repeal and replace the Affordable Care Act. He predicted victory in a vote on a revamped bill, scheduled for Thursday, that legislators say is still too close to call.