A search is presented for the associated production of a Higgs boson with a top quark pair in the all-jet final state. Events√ containing seven or more jets are selected from a sample of proton-proton collisions at s = 13 TeV collected with the CMS detector at the LHC in 2016, corresponding to an integrated luminosity of 35.9 fb−1. To separate the ttH signal from the irreducible tt + bb background, the analysis assigns leading order matrix element signal and background probability densities to each event. A likelihood-ratio statistic based on these probability densities is used to extract the signal. The results are provided in terms of an observed ttH signal strength relative to the standard model production cross section µ = σ/σSM, assuming a Higgs boson mass of 125 GeV. The best fit value is ˆµ = 0.9 ± 0.7(stat) ± 1.3(syst) = 0.9 ± 1.5 (tot), and the observed and expected upper limits are, respectively, µ < 3.8 and < 3.1 at 95% confidence levels.