Efficient and effective path planning can significantly enhance the task execution capabilities of UAVs in complex environments. This paper proposes an improved sampling-based path planning algorithm, Bi-APF-RRT*, which integrates an Artificial Potential Field (APF) method with a newly introduced repulsive coefficient and incorporates dynamic step size adjustments. To further improve path planning performance, the algorithm introduces strategies such as dynamic goal biasing, target switching, and region-based adaptive sampling probability. The improved Bi-APF-RRT* algorithm effectively controls sampling direction and spatial distribution during the path search process, avoiding local optima and significantly improving the success rate and quality of path planning. To validate the performance of the algorithm, this paper conducts a comparative analysis of Bi-APF-RRT* against traditional RRT* in multiple simulation experiments. Quantitative results demonstrate that Bi-APF-RRT* achieves a 59.6% reduction in average computational time (from 5.97 s to 2.41 s), a 20.6% shorter path length (from 691.56 to 549.21), and a lower average path angle (reduced from 33.28° to 29.53°), while maintaining a 100% success rate compared to 95% for RRT*. Additionally, Bi-APF-RRT* reduces the average number of nodes in the search tree by 45.8% (from 381.17 to 206.5), showcasing stronger obstacle avoidance capabilities, faster convergence, and smoother path generation in complex 3D environments. The results highlight the algorithm’s robust adaptability and reliability in UAV path planning.