The heat capacity of a given probe is a fundamental quantity that determines, among other properties, the maximum precision in temperature estimation. In turn, is limited by a quadratic scaling with the number of constituents of the probe, which provides a fundamental limit in quantum thermometry. Achieving this fundamental bound with realistic probes, i.e. experimentally amenable, remains an open problem. In this work, we tackle the problem of engineering optimal thermometers by using networks of spins. Restricting ourselves to two-body interactions, we derive general properties of the optimal configurations and exploit machine-learning techniques to find the optimal couplings. This leads to simple architectures, which we show analytically to approximate the theoretical maximal value of and maintain the optimal scaling for short- and long-range interactions. Our models can be encoded in currently available quantum annealers, and find application in other tasks requiring Hamiltonian engineering, ranging from quantum heat engines to adiabatic Grover's search.