The energy stored in a capacitor when the battery is disconnected is given by:
\[
E_1 = \frac{1}{2} C_0 V_0^2
\]
When the distance between the plates is doubled with the battery disconnected, the capacitance becomes \( \frac{C_0}{2} \). So, the energy becomes:
\[
E_1 = \frac{1}{2} \left(\frac{C_0}{2}\right) V_0^2 = \frac{1}{4} C_0 V_0^2
\]
When the battery is connected, the voltage remains constant, and doubling the distance between the plates reduces the capacitance by half, but the energy is given by:
\[
E_2 = \frac{1}{2} \left(\frac{C_0}{2}\right) V_0^2 = \frac{1}{4} C_0 V_0^2
\]
Thus, the ratio \( \frac{E_2}{E_1} \) is:
\[
\boxed{\frac{E_2}{E_1} = 0.25}
\]