The rapid escalation of ransomware attacks has become a significant threat to individuals, organizations, and critical infrastructures, resulting in substantial financial losses and operational disruptions. A novel approach was developed through the application of machine learning techniques combined with file entropy analysis to provide an early detection system capable of identifying ransomware infections before critical files are encrypted. The method leverages entropy as a statistical measure of file randomness, allowing for the detection of encrypted or disordered files that are indicative of ransomware activity. Machine learning models, such as Random Forests and Support Vector Machines, were trained to classify files based on entropy and additional metadata, demonstrating high accuracy, precision, and recall across a diverse dataset of benign and ransomware-infected files. The results indicated that entropybased detection outperforms traditional signature-based methods, particularly in identifying zero-day ransomware variants. Future work includes the development of real-time monitoring systems for continuous entropy assessment, as well as exploring the use of deep learning to enhance detection performance. Integrating these advancements into practical, real-time environments holds significant promise for mitigating ransomware attacks before substantial damage occurs.