Illness caused by foodborne pathogens represents an important economic and public health burden worldwide. In order to minimize the occurrence of foodborne pathogens in the food production chain and thereby increase the food safety, better detection methods and knowledge about the behavior of pathogens are needed. The introduction of the molecular diagnostics methods based on detection of the organisms nucleic acids have made detection, identification and characterization of foodborne pathogens faster and with greater specificity and sensitivity. The objectives of research in this thesis were to investigate the use of different nucleic acid based methods for molecular diagnostics of foodborne pathogens focusing on Salmonellaand Bacillus cereuswith respect to improve food safety. The work represents two parts of molecular diagnostics; the characterization Salmonellafor better understanding of its behavior in pork processing environments, and detection of B. cereusin food, feed and water samples without prior cultivation. The persistence of Salmonellain food production chains has been suggested to be a result of bacterial attachment and surface colonization. It was found that the physiological state of Salmonellahas an impact on the ability of Salmonellato attach to a pork meat surface and subsequently the possibility of contributing to cross contamination in the slaughter-line. Cells that were grown immobilized prior application on a pork meat surface were found to be more easily removed. In the pork processing, Salmonellamight appear in an immobilized state on the pork surfaces where low attachment ability might pose a risk for cross contamination. A stronger attachment to a surface makes on the other hand decontamination steps more difficult. The attachment ability of Salmonellacould to some extend be connected to specific genes. Deletion of either of the operons prgor flhDCin S. Typhimurium resulted in lower attachment ability to the pork meat surface. In addition, was it found that a S. Rissen isolate with low attachment ability after immobilized growth lacked two fimbriae genes, safC and lpfD,important for the adhesion and biofilm formation. It was further found that S. Typhimurium exposed to a heat shock was more resistance to heat and acid inactivation conditions, which might make later decontamination steps more difficult and subsequently lead to a higher risk of contamination of food products. Deliberate or accidental contamination of food, feed and water supplies pose a threat to human health worldwide and the need for generic detection methods that can screen for many pathogens at the time are highly desirable. A metagenomics based direct 16S rDNA sequencing approach was evaluated as a diagnostic tool for screening of unknown bacteria in bottled water without prior cultivation. B. cereusartificially inoculated in bottled water was used as a model. The results revealed that the method was able to detect B. cereusat levels of 105-106 CFU/L, a detection level low enough for detection in outbreaks situations. Consequently, the method was found to be a good candidate as a method for detection of B. cereusand for screening of other bacterial contaminants in water samples. The capability of the method was further evaluated on a variety of food and feed model samples. Before the method could be adapted to these types of samples, an optimization of the total DNA extraction step was applied. Five different commercial available DNA extraction kits were evaluated and the MasterPure DNA Purification Kit was found to be suitable for the food and feed samples. The detection of B. cereusin food and feed samples was found to be more complicated and for the method to be used for this type of samples, additional optimizations have to be conducted. In conclusion, the work present in this thesis contributes to the better understanding of the behavior of Salmonellain the pork processing and which factors that might influence the persistence and adaption. The information can be used for control of Salmonella by contributing to developments of more specific control measures and treatments within the food production-line and thereby improve the food safety. In addition, the method for direct detection of B. cereusin different biological matrices was found promising with the potential to be adapted for screening of bacterial contamination. This makes the method useful in outbreaks situations where the causing agent might be unknown.