It should be noted that in some practical tasks, it is impossible not to take into account the temperature change. In this case, the energy equation should be added to the filtration equations. The algorithms of «random walk by spheres» and «random walk along boundaries» of Monte Carlo methods are used to solve regular degenerate filtration problems of two immiscible inhomogeneous incompressible liquids in a porous medium. The derivatives of the solution are evaluated using Monte Carlo methods. A model problem of filtration of a two-phase incompressible liquid with capillary forces is considered.