In order to study the adaptability of a multi-redundancy and multi-degree-of-freedom snake-like robot to underwater motion, a two-dimensional (2-D) obstacle avoidance control algorithm for a snake-like robot based on immersed boundary-lattice Boltzmann method (IB-LBM) and improved artificial potential field (APF) is proposed in this paper. Firstly, the non-linear flow field model is established under the framework of LBM, and the IB method is introduced to establish a fluid solid coupling of a 2-D soft snake-like robot. Then, the obstacle avoidance of a snake-like robot in a flow field is realized by optimizing the curvature equation of the serpentine curve and eliminating the local minimum in APF method. Finally, the effects by exerted different control parameters on a snake-like robot’s obstacle avoidance capability are analyzed via MATLAB simulation experiment, by which we can find the optimal parameter of the obstacle avoidance and testify the validity of the proposed control algorithm.