A search for electroweak production of a single vectorlike T quark in association with a bottom (b) quark in the all-hadronic decay channel is presented. This search uses proton-proton collision data at s=13 TeV collected by the CMS experiment at the CERN LHC during 2016–2018, corresponding to an integrated luminosity of 138 fb−1. The T quark is assumed to have charge 2/3 and decay to a top (t) quark and a Higgs (H) or Z boson. Hadronic decays of the t quark and the H or Z boson are reconstructed from the kinematic properties of jets, including those containing b hadrons. No deviation from the standard model prediction is observed in the reconstructed tH and tZ invariant mass distributions. The 95% confidence level upper limits on the product of the production cross section and branching fraction of a T quark produced in association with a b quark and decaying via tH or tZ range from 1260 to 68 fb for T quark masses of 600–1200 GeV. © 2024 CERN, for the CMS Collaboration 2024 CERN