Fresh supermarkets are affected by commodity attributes and transaction time, and usually need to be replenished every day. It is of great significance to study the distribution law of sales volume of each category and single product, and to give replenishment and pricing strategies for the commercial supermarket to maximize its revenue. Based on the machine learning method, this paper analyzes the sales flow records of a supermarket in the past three years, obtains the sales rules of each category, and establishes a dynamic optimization model for subsequent pricing and replenishment decisions. The steps are as follows: Firstly, data preprocessing is carried out. Secondly, the kernel density estimation method is used to analyze the distribution law of the total sales volume of each category. With the help of correlation coefficient Screening feature selection method, neural network method and regression tree method, the first 33 single vegetable variables that have an important impact on the total sales volume of vegetables and meet the given constraints are comprehensively selected. Based on these 33 variables, the revenue function of single product sales, single product pricing, single product replenishment and single product wholesale price is constructed, so that the optimization problem of the revenue function is transformed into a constrained optimization problem of a quadratic function of the cost markup rate, and the specific pricing and replenishment strategy on July 1,2023 is obtained. The model established in this study can provide some new solutions to the vegetable pricing and replenishment strategy of supermarket.