To address the challenges faced in detecting malicious vehicles on the Internet of Vehicles, as well as the limitations of utilizing positive and negative response frequencies to adjust reputation values and the loss of independent judgment when relying on vehicle location and time data, a trust management mechanism based on non-cooperative game theory is proposed. This mechanism aims to identify malicious vehicles by evaluating whether their strategies satisfy utility functions. By incorporating both positive and negative interaction frequencies and historical trust data, the mechanism successfully resolves the issue of malicious vehicle switch attacks while ensuring a stable increase in reputation values. Simulation results demonstrate the effectiveness of the proposed approach in accurately detecting switch attacks by malicious vehicles and its strong resilience against slander attacks.