Hostile machine learning has network security issues that reduce prediction model accuracy. A full defence against these assaults entails establishing hostile scenarios, strengthening models via strategy training, and applying powerful defences. Small adjustments introduce antagonistic inputs into the research. These teach the model to recognize and withstand deception attempts. The proposed solution competed with Trust Shield, Secure Guard, Defend, and Adversary Block in rigorous performance testing. The recommended strategy has a 95.0% success rate for discovering assaults and a much lower 5.0% false positive rate. This is much superior to conventional approaches. Due to its modest accuracy loss and rapid response, it's effective at fighting assaults. This comprehensive overview demonstrates the wide-scale application of the strategy with minimal resources. Finally, this research emphasizes the need for robust and adaptable AI security. This will assist in creating secure and trustworthy AI solutions to protect sensitive data and ensure prediction model accuracy in an increasingly hostile future.