WASHINGTON—U.S. military and intelligence officials are at odds over the direction of the war in Afghanistan, creating a new source of friction as President Trump and his national security team seek a way to end the 17-year-old conflict, American officials said.

Intelligence officials have a pessimistic view of the conflict, according to people familiar with a continuing classified assessment, while military commanders are challenging that conclusion by arguing that Mr. Trump’s South Asia strategy is working.

The...