Tunable fiber lasers are a promising light source in all-optical wavelength conversion, fiber grating sensing and optical add-drop multiplexing. In order to achieve a tunable wavelength in the output, optical filters are indispensable for the construction of tunable fiber lasers. Recently, much attention has been given to developing high-performance filters. This paper proposes an environment-insensitive filter based on a Sagnac interferometer which was designed by an all-polarization-maintaining fiber with linear birefringence. According to the Sagnac interferometer, we derived the transfer function of an environment-insensitive filter. Based on this principle, it is shown that the device is able to implement a precision filtering function that can be used in a fiber laser’s optical resonant cavity. The experiment results demonstrated the effectiveness of this structure.