This research investigates the effectiveness of the Random Forest algorithm in optimizing e-commerce inventory management. In a digital business that continues to grow, inventory management is crucial for smooth operations and customer satisfaction. The Random Forest algorithm, a development of the CART method by applying bagging techniques and random feature selection, was tested to predict inventory. An experimental design is used to test the algorithm's performance algorithms performance, using data relevant to the observed inventory variables. The analysis involves evaluating the performance of algorithms in predicting and preventing stockouts. The results show that the Random Forest algorithm provides more accurate inventory predictions than traditional methods. Comparison with linear and rule-based regression reveals higher accuracy, making this algorithm a promising choice for e-commerce inventory management. These findings imply that the Random Forest Algorithm can be an effective solution in overcoming the complexity and fluctuations of digital markets. Practical recommendations include a deep understanding of the data, engagement of trained human resources, and training strategies for optimal use of these algorithms. This research also contributes to the literature by expanding understanding of the application of the Random Forest algorithm in various contexts, including forest basal area prediction, supply chain management, and backorder prediction. In conclusion, the Random Forest algorithm has great potential to improve e-commerce inventory management, opening up opportunities for broader application in the digital business world. Proactive adoption of these algorithms can have a positive impact on operational efficiency, customer satisfaction, and a company's competitiveness in an ever-evolving market.