Ransomware attacks have increasingly threatened the integrity of digital infrastructures, compromising sensitive data and disrupting business operations worldwide. The complexity and rapid evolution of ransomware strains render traditional detection methods insufficient, prompting the need for more proactive and adaptive solutions. A novel machine learning-based method for automated file trap selection is introduced, offering early detection of ransomware through strategically deployed decoy files. This approach leverages machine learning models, such as Random Forest, SVM, and Neural Networks, to identify and respond to ransomware behaviors with high accuracy and low false positive rates. Additionally, reinforcement learning is employed to dynamically optimize the placement of file traps, ensuring that the system adapts to emerging threats in real-time. Comprehensive experiments across various ransomware families reveal that the system consistently achieves robust detection, minimal latency, and scalability across different environments. The findings emphasize the effectiveness of combining advanced machine learning algorithms with real-time feature extraction to significantly enhance ransomware detection capabilities.