Using a pump-probe differential transmission experiment in heterodyne detection, we measured the refractive index dynamics at the ground-state excitonic transition in electrically pumped InAs/GaAs quantum-dot amplifiers emitting near 1.3 mu m at room temperature. We compare three samples differing only in the level of p-doping, and interpret the measured index changes taking into account the gain dynamics in these devices. We find that in absorption, the excess hole density due to p-doping accelerates the recovery and reduces the refractive index change, since filling of the hole states by p-doping shifts the induced changes in the hole population toward high energy states. Conversely, in gain, the reduced electron reservoir in the excited states in p-doped devices results in slower gain recovery dynamics and in larger refractive index changes compared to undoped devices operating at the same modal gain. The linewidth enhancement factor inferred from these measurements shows that p-doping is effective in reducing this parameter mainly due to the larger differential gain in p-doped devices in the gain regime.