This article proposes an optical fiber sensor based on fiber surface plasmon resonance (SPR) and Mach-Zehnder interferometer(MZI), which can measure salinity and temperature at the same time. The sensor adopts a transmission structure, which is made of thin-core optical fiber and single-mode optical fiber at both ends. A gold film is used as the metal film to excite SPR, and the MZI effect is generated through the dislocation structure. Experiments have shown that this structure can achieve simultaneous sensing of salinity and temperature. In the temperature range of 32-45°C and the salinity range of 0-20‰, the SPR salinity sensitivity is 3.25nm/‰, the SPR temperature sensitivity is -0.75nm/°C, the MZI temperature sensitivity is -0.39nm/°C, MZI salinity sensitivity is 2.386nm/‰. Machine learning algorithms are used for parameter demodulation to improve the accuracy of dual parameter measurements of salinity and temperature. The sensor has outstanding features such as small size, excellent performance, simple production and high precision.