The invention relates to the technical field of radio positioning, in particular to a time division multichannel random code phase-modulation shipborne collision-proof radar. A mast or the top of a ship is provided with a receiving/emitting two-purpose quasi-optical integrated dielectric lens antenna annular array; a DSP encoder pulses perform scanning so as to omni-directionally guard against a target possibly collided on a water surface; data of a water photographic sensor, a ship speed sensor and a global positioning system (GPS) sensor access an MCU control time division circuit to generate time division millimeter-wave multichannel random codes for phase modulation, and are emitted through an upconverter, an R/T3, a frequency multiplier and power amplifier, an R/T2, an optical circulator, a beam switch and an antenna array; and back waves are subjected to processing control in the DSP and the MCU through the antenna array, the beam switch, the optical circulator, an R/T1, a low noise high frequency amplifier, a fourth-harmonic mixer, an intermediate frequency amplifier, a time division circuit, and a related multichannel signal extraction module. The radar ensures that adjacent ships in the same water area sail without mutual interference and operate in a coexisting way, has high electromagnetic compatibility EMC, inhibits false-alarm and determines positions, distances and relative speeds of targets through the DSP when meeting multiple targets, displays three-dimensional images and identifies a target closest to the ship through a CRT, performs the audible and visualalarm if the distance of the target is smaller than a safety distance, intelligently avoids a barrier or reduces speed if the distance of the target is approximate to a danger distance, and controlsand references the water photography to combine the ship speed and the current position data provided by the GPS to make a choice, thereby obviously improving the sailing safety of the ship.