<span>Wireless sensor network (WSN) is a collection of wireless sensor nodes which are distributed in nature and a base station where the dispersed nodes are used to monitor and the physical conditions of the environment is recorded and then these data are organized into the base. Its application has been reached out from critical military application such as battlefield surveillance to traffic, health, industrial areas, intruder detection, security and surveillance. Due to various features in WSN it is very prone to various types external attacks. Preventing such attacks, intrusion detection system (IDS) is very important so that attacker cannot steal or manipulate data. Data mining is a technique that can help to discover patterns in large dataset. This paper proposed a data mining technique for different types of classification algorithms to detect denial of service (DoS) attacks which is of four types. They are Grayhole, Blackhole, Flooding and TDMA. A number of data mining techniques, such as KNN, Naïve Bayes, Logistic Regression, support vector machine (SVM) and ANN algorithms are applied on the dataset and analyze their performance in detecting the attacks. The analysis reveals the applicability of these algorithms for detecting and predicting such attacks and can be recommended for network specialist and analysts. </span>