Extracting head waves and subsequently uploading their results from the downhole to the surface system in real time could improve the real-time guidance of ultrasonic imaging logging while drilling (UILWD) for drilling operations. To realize the downhole real-time extraction of head waves in this logging, three aspects were explored in this study. First, an improved energy ratio head-wave arrival extraction algorithm based on the weighting coefficients and characteristic functions, along with an amplitude detection method relying on peak-to-peak values, was proposed. Second, an echo reception pre-processing analog circuit and a digital signal processing circuit based on FPGA were designed. A pipeline algorithm was developed in FPGA to extract the arrival time and amplitude of the head wave. Finally, software simulations, laboratory tests, and field experiments related to this method were conducted. Our results showed that the real-time head-wave extraction method demonstrated a strong anti-noise ability in real time. The maximum relative error of the arrival time was less than 5%. The relative error of the amplitude was acceptable, and 90% of this value was within 5%. Through the measurement, the time of processing a single-channel waveform by a downhole algorithm was less than 15 ms, thus meeting the requirements for the real-time processing of downholes.