Current systems for metal detection in dry food processing are limited by relatively large foreign objects and high-cost implementation. These issues are resolved here using a non-contact, cylindrical microwave cavity resonator sensor where food passes through the cavity and metallic objects are detected by a shift in the resonant frequency. Classic perturbation theory is applied to the basic set-up and numerical simulations are used to verify the design of the sensor. A cavity sensor was fabricated with a quartz tube symmetrically located for dry food flow and metal detection. Good performance is demonstrated for a range of foods such as spaghetti, noodles, rice, wheat flour and soy milk powder. It is shown that the resonance frequency shift becomes larger when the foreign body gets closer to the cavity centre. The frequency variation is directly related to the volume of the object, and it is estimated that the minimum diameter of a detectable ball can be lower than 2 mm. For completeness it is also observed that the set-up can be used to detect dielectric objects. A graphical user interface is developed for practical applications. The method proposed is low-cost, convenient, scalable and complementary to other metallic contaminant detection approaches. • A new microwave sensor is developed for metal contamination detection in dry foods. • The presence of a metallic object causes a resonance frequency shift. • Effects of the position, volume and shape of the object are thoroughly studied.