The invention provides a stratum density measuring while drilling instrument based on a deuterium-tritium accelerator neutron source. The stratum density measuring while drilling instrument is used for measuring the density of a stratum around a well hole in the well drilling process, and meanwhile can measure the neutron porosity. According to the stratum density measuring while drilling instrument, a U-shaped groove is formed in one side of a drill collar, a fast neutron monitoring detector and a neutron generator are arranged inside a neutron generator module compression resistance cylinder, a neutron shielding body, a first thermal neutron detector, a neutron shielding body, a second thermal neutron detector, a gamma ray shielding body, a gamma detector and a control processing circuit are sequentially installed inside a detector installation skeleton from top to bottom, and the neutron generator module compression resistance cylinder and the detector installation skeleton are connected and fixed into the U-shaped groove through a coupling connector. The stratum density measuring while drilling instrument adopts the deuterium-tritium accelerator neutron source for measuring the stratum density, a chemical gamma radioactive source is prevented from being used, damage to people and environment is eliminated, and the measuring precision is effectively improved by monitoring the neutron yield in real time.