Every evolution of a fluid is uniquely described by an energy tensor. But the converse is not true: an energy tensor may describe the evolution of different fluids. The problem of determining them is called here the inverse problem. This problem may admit unphysical or non-deterministic solutions. This paper is devoted to solve the inverse problem for perfect energy tensors in the class of perfect fluids evolving in local thermal equilibrium (l.t.e.). The starting point is a previous result (Coll and Ferrando in J Math Phys 30: 2918-2922, 1989) showing that thermodynamic fluids evolving in l.t.e. admit a purely hydrodynamic characterization. This characterization allows solving this inverse problem in a very compact form. The paradigmatic case of perfect energy tensors representing the evolution of ideal gases is studied in detail and some applications and examples are outlined.