Fishing operations are one of the most important parts of drilling operations. If the fishing operation fails, the other direction should be considered to continue drilling and reach the desired depth, which can be achieved by using sidetracking operations. The long-term fishing operation increases the cost and time of the drilling operation, therefore, should try to have a successful fishing operation in the shortest possible time. It can be said that the execution of the fishing operation is economical as long as the costs of the fishing operation are less or at least equal to the cost of the sidetracking operation. Therefore, the optimal time for fishing must be determined so that the drilling operation to be economical. Many statistical analysis methods have been used to determine the optimal time, but due to insufficient accuracy and time-consuming calculations, they are not popular. In this study, for the Gachsaran oil field a Machine Learning (ML) model with a regression algorithm were used to estimate an optimal time of Fishing operations. To calculate the optimal fishing time, the fishing cost rate and fishing depth as input data was first collected and categorized based on different sections of the Gachsaran oil field. Then the sidetracking cost is predicted by the machine learning model and this cost was equated to the fishing cost in worst conditions and in the result the optimal fishing time was calculated for each individual section. The result shows that the model can estimate the cost of sidetracking with an error of less than 2%. Using the designed model and the input data of Gachsaran oil field, considering the average optimal fishing time, it is possible to save an average of 1 million dollars and 16 hours in drilling a well.