Recent observations of the filamentary molecular clouds show that their properties deviate from the isothermal equation of state. Theoretical investigations proposed that the logatropic and the polytropic equations of state with negative indexes can provide a better description for these filamentary structures. Here, we aim to compare the effects of these softer non-isothermal equations of state with their isothermal counterpart on the global gravitational instability of a filamentary molecular cloud. By incorporating the ambipolar diffusion, we use the non-ideal magnetohydrodynamics framework for a filament that is threaded by a uniform axial magnetic field. We perturb the fluid and obtain the dispersion relation both for the logatropic and polytropic equations of state by taking the effects of magnetic field and ambipolar diffusion into account. Our results suggest that, in absence of the magnetic field, a softer equation of state makes the system more prone to gravitational instability. We also observed that a moderate magnetic field is able to enhance the stability of the filament in a way that is sensitive to the equation of state in general. However, when the magnetic field is strong, this effect is suppressed and all the equations of state have almost the same stability properties. Moreover, we find that for all the considered equations of state, the ambipolar diffusion has destabilizing effects on the filament.