Microscopic theory of a dimer in random potential