Since it is difficult to filter out the rainfall interference directly from the X-band marine radar image, it is necessary to detect whether the collected radar image contains rainfall interference to control the quality of the radar image. Aiming at the problem of rainfall recognition in X-band marine radar images, a new rainfall detection method is proposed by using principal component analysis (PCA) technology to reduce dimensions and extract features from radar images. Based on the calculated distance between the features to be tested and the known features, the <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$k$ </tex-math></inline-formula> -nearest neighbor (KNN) algorithm is utilized to determine the classification task of the radar image and recognize the rainfall radar image. The experimental result illuminates that the detection accuracy of the proposed method reaches 99.3% and is 2.0% higher than that of the support vector machine (SVM)-based method. Meanwhile, the proposed method shows good classification performance for the rain-contaminated images under different rainfall intensities.