The invention belongs to the field of oil and gas resource exploitation, and relates to a wellhead foam drainage gas production foam automatic detection device which comprises an automatic detection front end, a detection system part and a mechanical structure part. The automatic detection front end comprises a capacitance detection front end and an infrared detection front end, and the detection system takes an MCU as a core controller to realize acquisition, processing and transmission of a detection result; the mechanical structure part comprises a sealing lens, an infrared mounting head, an infrared sensor shell, an optical cavity, a processing system upper shell, a processing system lower shell, a detection front end upper shell, a detection front end lower shell, a detection capacitor, a capacitance sensor shell, a capacitor mounting head and a device shell. According to the device, the wellhead foam can be detected in real time, the accuracy and the real-time performance of detection are improved by adopting the capacitance detection front end and the infrared detection front end, the collected data are analyzed and processed by utilizing the micro-control system, the result is automatically transmitted to the mobile terminal, and the automatic control is completed.