NEW YORK—President Trump on Friday disputed one of his longtime lawyer’s criticisms of his behavior and questioned whether a forthcoming book by Jay Goldberg runs afoul of lawyer-client privilege.

In a telephone interview, Mr. Trump suggested that Mr. Goldberg is unhappy that he wasn’t tapped for a White House role.

Mr. Trump cited economic gains, rising consumer confidence and a strengthening military as proof of a successful tenure and said, “I’ve had nothing but victories, so it’s sad that somebody you can’t take to Washington for obvious reasons wants to write a book.”

He added: “We’re hitting new records every day.”

Mr. Goldberg represented Mr. Trump in divorce cases involving two ex-wives, Ivana Trump and Marla Maples. His memoir, “The Courtroom Is My Theater,” is due to be released in December.

Mr. Trump questioned whether it is appropriate for Mr. Goldberg to write about a client.

“There’s lawyer-client privilege here. You can’t do that,” he said.

In reply, Mr. Goldberg said through a spokeswoman that “Jay is very cognizant of that issue,” adding, “the book will definitely not reveal anything that will violate attorney-client privilege.” The spokeswoman said Mr. Goldberg “never wanted to go to Washington.”

In an interview at his Manhattan home, whose entryway is decorated with a framed collection of appreciative notes from Mr. Trump, Mr. Goldberg said the president’s private legal team has done him a disservice by alternately praising and condemning Michael Cohen, who has implicated Mr. Trump in campaign-finance violations related to hush money payments to two women.

He also said that Mr. Trump sustained attacks from political foes and the press have left the president “punch-drunk,” causing him to lash out without “appropriate restraint.”

Mr. Goldberg said he has been dismayed by some of Mr. Trump’s comments, including recent assertions about a strong administration response to Hurricane Maria, which killed 3,000 people in Puerto Rico.

“There’s so much pounding against him from all different directions, he says things that if he had chance to reflect he wouldn’t say,” Mr. Goldberg said.

Later, Mr. Goldberg said through the spokeswoman that he didn’t mean that Mr. Trump was punch-drunk. Rather, he said that he would be punch-drunk if he had to endure the attacks that Mr. Trump has seen as president.

Talking to Mr. Trump about the book in January, Mr. Goldberg said: “There’s stuff in there about you, Donald.”

“I’m going to make it a best-seller,” Mr. Trump said, according to Mr. Goldberg.

He said the two have stayed on good terms, with Mr. Trump calling him last year and asking him to provide legal advice on a more formal basis in Washington.

“I could really use you here, Jay,” Mr. Trump said, according to an excerpt from the book.

Mr. Goldberg, 85 years old, declined the offer, saying he was busy with other cases.

A former prosecutor, Mr. Goldberg said that in a phone conversation in April Mr. Trump asked what he thought of Rudy Giuliani, whom the president hired around that time to represent him in the Russia probe. Mr. Goldberg said he replied that he had misgivings.

In the same call, Mr. Goldberg advised the president that Mr. Cohen could turn against him and cooperate with the government.

Watching the Cohen case unfold over the past few months, Mr. Goldberg said that Mr. Giuliani erred in providing different accounts of Mr. Cohen’s trustworthiness.

In May, Mr. Giuliani told ABC News that Mr. Cohen was “an honest, honorable lawyer.” Two months later, amid reports that Mr. Cohen had secretly recorded Mr. Trump during a private conversation in 2016, Mr. Giuliani cast Mr. Cohen as a “liar” and a “pathological manipulator.”

“Giuliani made a cardinal mistake. He said Michael Cohen was an honorable person and could be counted on to tell the truth. That’s counterproductive to the position that Donald would take,” Mr. Goldberg said.

Asked about Mr. Goldberg’s contention, Mr. Giuliani said in an interview: “Horseshit.”

“I praised him [Mr. Cohen] when he was telling the truth and condemned him when he was lying,” Mr. Giuliani said.

Mr. Goldberg, he added, “has no idea what we’re doing.”

“He just wants to sell his book, which he won’t do,” Mr. Giuliani said.

Donald Trump with Jay Goldberg, right, in 1991. Mr. Goldberg represented Mr. Trump in divorce cases involving two ex-wives, Ivana Trump and Marla Maples. Photo: Mario Cabrera/Associated Press

Mr. Cohen pleaded guilty last month to criminal charges that included campaign-finance violations stemming from a $130,000 payment he made to the adult-film actress Stephanie Clifford and a $150,000 payment he coordinated to the former Playboy model Karen McDougal. The two women said they had affairs with Mr. Trump.

Mr. Trump and his representatives previously denied that he knew about the payments at the time they were made.

Mr. Goldberg said he believes that no hush payments should have been made.

“I never would do that because I never do anything which cannot stand the light of day,” he said.

He added: “Never give a person anything to hold over our head.”

Mr. Trump’s representatives have denied that he had affairs with either Ms. McDougal or Ms. Clifford, known professionally as Stormy Daniels.

For his part, Mr. Goldberg said he believes the affairs likely took place.

“He’s a devil-may-care guy,” Mr. Goldberg said of the president.

Mr. Goldberg recalls Mr. Trump as a disciplined client who heeded legal advice.

“He wanted to sue this person, he wanted to sue that person,” he said. “He felt very strongly about it. I would reject it; he would listen.”

In the White House, Mr. Trump doesn’t appear to have surrounded himself with a senior team whose advice he will heed, Mr. Goldberg said.

Still Mr. Goldberg said he would vote to re-elect Mr. Trump.

Write to Peter Nicholas at peter.nicholas@wsj.com