ABSTRACT One of the major challenges we face is how to quickly and accurately create the three-dimensional (3D) density distributions of interstellar dust in the Milky Way using extinction and distance measurements of large samples of stars. In this study, we introduce a novel machine-learning approach that utilizes a convolution neural network, specifically a V-net, to infer the 3D distribution of dust density. Experiments are performed within two regions located towards the Galactic anticentre. The neural network is trained and tested using 10 000 simulations of dust density and line-of-sight extinction maps. Evaluation of the test sample confirms the successful generation of dust density maps from extinction maps by our model. Additionally, the performance of the trained network is evaluated using data from the literature. Our results demonstrate that our model is capable of capturing detailed dust density variations and can recover dust density maps while reducing the ‘fingers of god’ effect. Moving forward, we plan to apply this model to real observational data to obtain the fine distribution of dust at large and small scales in the Milky Way.