President Biden said he is confident the November presidential election will be fair, but he isn’t sure it will be peaceful if Republican nominee Donald Trump loses his bid to return to the White House.

“I’m confident it will be free and fair. I don’t know whether it will be peaceful,” Biden said Friday at the White House in the first briefing-room appearance of his presidency. “The things that Trump has said, and the things that he said last time out, when he didn’t like the outcome of the election, were very dangerous.”

Biden pointed to Tuesday’s vice-presidential debate , saying Trump’s running mate, Sen. JD Vance (R., Ohio), “did not say he’d accept the outcome” of the 2024 election and still hadn’t accepted the 2020 results.

When asked by fellow vice-presidential nominee and Minnesota Gov. Tim Walz whether Trump lost the 2020 election, Vance declined to answer, saying he was “focused on the future.” In response, Walz said: “That is a damning non-answer.”

On Wednesday, Vance declined to answer the question again during a campaign event in Auburn Hills, Mich., where he was asked about the exchange.

“I’m focused on the election of 33 days from now because I want to throw Kamala Harris out of office and get back to common-sense economic policies,” he said. The 2024 election was going to be safe and secure, he added.

The Trump campaign, in a response to Biden’s comments, said the former president has said he will accept the results of a free and fair election.

Biden also said during Friday’s briefing that he didn’t know whether Israeli Prime Minister Benjamin Netanyahu was stalling on a peace deal in an attempt to influence the U.S. election.

“No administration has helped Israel more than I have,” Biden said. “None. None, none. And I think Bibi should remember that. And whether he’s trying to influence the election, I don’t know but I’m not counting on that.”

The race between Trump and Democratic presidential nominee Kamala Harris likely will come down to a handful of swing states in a tight race.

During Harris’s debate with Trump in September, she raised the Jan. 6, 2021, attack on the Capitol that marked the culmination of then-President Trump’s efforts to overturn the 2020 election.

“Donald Trump left us the worst attack on our democracy since the Civil War,” Harris said. “And what we have done is clean up Donald Trump’s mess.”

Trump is trying to return to the White House while defending himself against criminal charges stemming from his efforts to remain in power. Last month, following a court hearing just blocks from the Capitol, a federal judge called for significant filings in Trump’s election-interference case in the weeks before voters go to the polls.

Since early 2021, about 1,500 people have been charged in connection with the Capitol attack, according to the Justice Department.

“Donald Trump the candidate has said in this election there will be a bloodbath, if this—and the outcome of this election—is not to his liking,” Harris said in last month’s debate. “Let’s turn the page on this. Let’s not go back. Let’s chart a course for the future and not go backwards to the past.”

Upon leaving the briefing room on Friday, Biden was asked if he would reconsider dropping out of the presidential race. “I’m back in,” he joked.

Write to Ginger Adams Otis at Ginger.AdamsOtis@wsj.com