Purpose The screw extruder is applied in cement-three-dimensional (3D) printing. The cement paste flow in 3D printing is the typical Herschel–Bulkley fluid. To understand the flow in the channel, the improved lattice Boltzmann method (LBM) is proposed. Design/methodology/approach For Herschel–Bulkley flow, an improved LBM is presented to avoid the poor stability and accuracy. The non-Newtonian effect is regard as a special forcing term. The Poiseuille flow is taken to discuss the detailed process of the method. With the method, the analytical solution and numerical solution are obtained and compared. Then, the effect of the initial yield stress on the numerical solution is both explored by the shear-thickening fluid and the shear-thinning fluid. Moreover, the variations of the relative errors under different lattice nodes and different power-law indexes are analyzed. Finally, the method is applied into the simulation of the flow in the extruder of cement-3D printing. Findings The results show that the improved method is effective for Herschel–Bulkley fluids, which can simulate the flow in the extruder stably and accurately. Practical implications The simulation can contribute to understand the cement paste flow in the screw extruder, which helps to optimize the structure of the extruder in the following periods. Originality/value The improve method provide a new way to analyze the flow in the extruder of cement-3D printing. Also, in the past research, LBM for Herschel–Bulkley fluid is ignored, whereas the study can provide the reference for the numerical simulation.