Mr. Obama has said anti-Muslim comments make it more difficult for the U.S. to get the cooperation of allies in the Middle East to fight the Islamic State, and such rhetoric discourages American Muslims from cooperating with law enforcement authorities.