We study two-electron states confined in two coupled quantum dots formed by a short-range potential in a two-dimensional topological insulator. It is shown that there is a fairly wide range of the system parameters, where the ground state is a tripletlike state formed by a superposition of two spin-polarized states. Outside this range, the ground state is a singlet. A transition between the singlet and triplet states can be realized by changing the potential of the quantum dots. The effect is caused by a significant change in the energies of the Coulomb repulsion and the exchange interaction of electrons due to the presence of the pseudospin components of the wave function when the band spectrum is inverted.