There should not be any harmful substances or dangerous levels of microorganisms in food and raw materials. It should be safe to eat at restaurants and buy food from the grocery store.
These are some reasons why food is being analysed. The purpose of food analysis is to confirm the safety and quality of food. Within the official control of food, at the food producers, the analysis must be performed by an accredited laboratory. Accredited laboratories are also performing many other types of food analysis.
Documents that contain accreditation requirements in Sweden
(EU) 2017/625, European Parliament and of the Council on official controls and other official activities performed to ensure the application of food and feed, law, rules on animal health and welfare, plant health and plant protection products
LIVSFS 2005:21 §§ 15-18, Livsmedelsverkets föreskrifter om offentlig kontroll av livsmedel
Documents providing guidance for compliance with accreditation requirements in Sweden
EA-4/09 G 2017, Accreditation for Sensory Testing Laboratories
EA-4/22 G:2018, Guidance on Accreditation of Pesticide Residues Analysis in Food and Feed
SANCO/12495/2011, Method validation and quality control procedures for pesticide residues analysis in food and feed
Documents that specify acceptance criteria or specify requirements for assessed objects/systems/persons
(EU) 396/2005, European Parliament and of the Council on maximum residue levels of pesticides in or on food and feed of plant and animal origin (art. 26)
(EC) 2073/2005, Commission Regulation on microbiological criteria for foodstuffs