Motor behavior can be executed deliberately to achieve specific goals. With repetition, such behavior can become habitual and noncontingent on actions-outcomes. The formation of habits is a natural process that can become pathological, such as in obsessive-compulsive disorder (OCD). The present study used the Sapap3-knockout (KO) mouse model of OCD to assess habit formation based on reward devaluation. We also tested wildtype mice under different training and food-restriction schedules to assess the extent of natural habit formation. We found that Sapap3-KO mice were insensitive to the devaluation of a sucrose reward under conditions in which wildtype littermates were sensitive to devaluation. Moreover, food restriction favored goal-directed action in wildtype mice, whereas mice that were fed ad libitum were more likely to form habitual behavior but nevertheless maintained partly goal-directed lever-press behavior. In conclusion, only Sapap3-KO mice developed behavior that was fully insensitive to reward devaluation, suggesting that pathological habits in OCD patients are recapitulated in the present Sapap3-KO mouse model. In wildtype mice, the extent of habit formation was influenced by the state of satiety during training and the reinforcement schedule.