Dileptons are considered as one of the cleanest signals of the quark-gluon plasma (QGP), however, the QGP radiation is masked by many background sources from either hadronic decays or semileptonic decays from correlated charm pairs. In this study we investigate the relative contribution of these channels in heavy-ion collisions from $sqrt{s_{rm NN}}=$ 8 GeV to 5 TeV with a focus on the competition between the thermal QGP radiation and the semileptonic decays from correlated $D-$meson pairs. As a tool we employ the parton-hadron-string dynamics (PHSD) transport approach to study dilepton spectra in Pb+Pb (Au+Au) collisions in a wide energy range incorporating for the first time a fully microscopic treatment of the charm dynamics and their semileptonic decays. We find that the dileptons from correlated $D-$meson decays dominate the thermal radiation from the QGP in central Pb+Pb collisions at the intermediate masses (1.2 GeV $< M <$ 3 GeV) for $sqrt{s_{rm NN}} > $ 40 GeV, while for $sqrt{s_{rm NN}}=$ 8 to 20 GeV the contribution from $D,{bar D}$ decays to the intermediate mass dilepton spectra is subleading such that one should observe a rather clear signal from the QGP radiation. We, furthermore, study the $p_T$-spectra and the $R_{AA}(p_T)$ of single electrons at different energies as well as the excitation function of the inverse slope of the $m_T$- spectra for intermediate-mass dileptons from the QGP and from charm decays. We find moderate but characteristic changes in the inverse slope parameter for $sqrt{s_{rm NN}} > $ 20 GeV which can be observed experimentally in high statistics data. Additionally, we provide detailed predictions for dilepton spectra from Pb+Pb collisions at $sqrt{s_{rm NN}} = $ 5.02 TeV.