Investigating internal-injector cavitating flow dynamics is difficult but important. The interaction of nozzle cavitation with the moving needle valve dictates the fuel mass flow rate and therefore spray combustion performance and emissions. In the present study, a two-dimensional low-Reynolds-number cavitating contracting-nozzle flow interacting with a moving valve is simulated using the lattice Boltzmann (LB) method. The Bhatnagar–Gross–Krook algorithm coupled with the immersed boundary method and an improved pseudo-potential multiphase flow model are employed and further developed based on the open-source LB code PALABOS. The performance of the immersed boundary method is first verified in a case where an oscillating cylinder moves according to a sine function in water. In order to improve the pseudo-potential model on its limitation of the density ratio, so to be used in engineering multiphase flow, the Carnahan–Starling equation of state is incorporated together with the exact difference method force scheme and an upgraded interaction force term. The upgraded pseudo-potential model proves via validations to be effective in improving numerical stability at large density ratios. With a seamless cooperation of the improved Shan–Chen model and the immersed boundary method achieved in PALABOS, cavitation in a contracting nozzle is simulated for a whole cycle of the valve motion. Cavitation dynamics under different fuel mass flow rates is investigated. It is found that cavitation dynamics, including interface conditions, cavitation bubble distributions, and inside-bubble vapor-phase flow fields, is distinctly different when the flow path is widely open and completely shut by the valve.