As above, when you have a positive (downwards) displacement.
For part a), in equilibrium, the spring tension must act upwards as gravity acts downwards so the resultant force is zero
mg + T = 0
mg is the load which is acting to extend the spring so in equilibrium it must be 24e, where the extension e=x-0.35. However, the tension in the spring (force pair, Newton 3) is -24e. Note that gravity is a constant force and for a vertical spring, its effect is to shift the equilibrium position downwards from the natural length to the position mg/24+0.35. It does not affect the dynamics otherwise.
For part b) as described above, the resultant force on P (positive downwards) must be
F = mx'' = mg - 24(x-0.35) - 14x'
gravity acts to extend x downwards, the tension in the spring (for a positive extension) pulls upwards and the resistance acts against the velocity as a re-tarding force. So just rearrange. Note when x=1.167, then mg-24(1.167-0.35) = 0 as youd expect as its the equilibrium extension.
The 14 on the right hand side of the final ODE corresponds g+24*0.35/m. You could have written ithe ODE as
z'' + 7z' + 12z = 0
where z = x-14 = x-(g+24*0.35/m). Here gravity has no effect on the dynamics and the variable z is zero at the equilibrium length calculated in part a (which is a vertical shift due to gravity). So z would correspond to the extension about the spring position 1.167.