In practical operating environments, it is extremely important for mobile robots to reach the target area quickly and safely. Therefore, a new path planning algorithm, APF-EB-RRT, based on the EB-RRT algorithm was proposed in this article. The artificial potential field algorithm was introduced into the APF-EB-RRT algorithm. By adding potential field constraints that simulate the interaction between objects to the dynamic reprogramming structure, the EB-RRT algorithm can avoid the problems of high randomness and poor directionality caused by the EB algorithm. Meanwhile, the APF-EB-RRT algorithm can effectively avoid collisions between robots and obstacles, and guide robots to the target area. The effectiveness of the APF-EB-RRT algorithm was demonstrated by numerical simulation results. The APF-EB-RRT algorithm exhibited better performance in various environments than the other four algorithms. In a real dynamic environment, this algorithm can provide better path planning for mobile robots, and has good application prospects in the field of path planning.