Michael R. Bloomberg, who for months quietly laid the groundwork to run for president as an independent, will not enter the 2016 campaign, he said Monday, citing his fear that a three-way race could lead to the election of a candidate he thinks would endanger the country: Donald J. Trump.

In a forceful condemnation of his fellow New Yorker, Mr. Bloomberg said Mr. Trump had run “the most divisive and demagogic presidential campaign I can remember, preying on people’s prejudices and fears.” He said he was alarmed by Mr. Trump’s threats to bar Muslim immigrants from entering the country and to initiate trade wars against China and Japan, and he was disturbed by Mr. Trump’s “feigning ignorance of white supremacists,” alluding to Mr. Trump’s initial refusal to disavow support from David Duke, a former Ku Klux Klan leader.

“These moves would divide us at home and compromise our moral leadership around the world,” Mr. Bloomberg said in a column published Monday on Bloomberg View, his opinion site. “The end result would be to embolden our enemies, threaten the security of our allies, and put our own men and women in uniform at greater risk.”