It is not safe to eat raw flour. Food Poisoning Bulletin warns that raw flour can contain pathogenic bacteria, and eating it can cause illness. Along with avoiding the consumption of any uncooked flour, it is important to treat raw flour the same as other potentially dangerous uncooked ingredients. To prevent cross-contamination, cooks should always sanitize surfaces exposed to raw flour and wash their hands after handling raw flour.
The New York Times reports that a 2009 E. coli outbreak was traced to the consumption of uncooked store-bought, ready-to-eat commercial cookie dough, and that the raw flour in the dough was likely the cause.
Dr. Karen Neil, a medical epidemiologist working for the Centers for Disease Control and Prevention, explains that raw flour was the only raw agricultural ingredient in the packaged uncooked cookie dough. Because it did not undergo any process to kill pathogens, it likely led to the contamination of the cookie dough. The eggs used in the dough were pasteurized, which kills pathogens, and the sugar, molasses, margarine and baking soda also went through several pathogen kill-steps during processing.
The New York Times reports that, according to a 2008 study, 53 percent of college students admitted to eating unbaked cookie dough.