The primary purpose of chemical analysis in food is to ensure that food products are safe for consumption. This involves detecting the presence of harmful substances like pesticides, heavy metals, and microbial contaminants. Additionally, it verifies that the nutritional content listed on food labels is accurate, helping consumers make informed dietary choices.