Cryptosporidium spp. is a major cause of diarrhea in developing countries, mainly affecting people with compromised immune systems in general and HIV-infected individuals with low CD4 + T-cell counts in particular. This infection is self-limiting in healthy persons; however, it can be severe, progressive and persistent in those who are immunocompromised. There are few published studies concerning cryptosporidiosis and Cryptosporidium genotypes in Iranian immunocompromised patients and none of them describe risk factors. This study was undertaken to identify prevalence, genotypes and risk factors for cryptosporidiosis in immunocompromised patients. Three fecal samples were obtained at two day intervals from each of the 183 patients and processed with modified Ziehl–Neelsen staining methods and 18S rRNA gene amplification and sequencing. The overall infection prevalence was 6%. Cryptosporidium parvum was identified in isolates from five HIV-infected patients, one patient who had undergone bone marrow transplantation and one with chronic lymphocytic leukemia. Cryptosporidium hominis was identified in isolates from two HIV-infected patients and two patients with acute lymphocytic leukemia. According to univariate analysis, the statistically significant factors were diarrhea (OR = 21.7, CI = 2.83–78.4, P= 0.003), CD4 + lymphocytes less than 100 cells/mm3 (OR = 41.3, CI = 13.45–114.8, P < 0.0001), other microbial infections (OR = 7.1321.7, CI = 1.97–25.73, P = 0.006), weight loss (OR = 73.78, CI = 15.5–350, P < 0.0001), abdominal pain (OR = 10.29, CI = 2.81–37.74.4, P= 0.001), dehydration (OR = 72.1, CI = 17.6–341.5, P < 0.0001), vomiting (OR = 4.87, CI = 1.4–16.9, P= 0.015), nausea (OR = 9.4, CI = 2.38–37.2, P < 0.001), highly active antiretroviral therapy (OR = 0.089, CI = 0.01–0.8, P= 0.015) and diarrhea in household members (OR = 7.37, CI = 2.04–26.66, P= 0.001). After multivariate analysis and a backward deletion process, only < 100 CD4 + T-lymphocytes/mm3 maintained a significant association with infection. The authors recommend that this infection should be suspected in patients with diarrhea, weight loss and dehydration in general and in diarrheal individuals with < 100 CD4 + T-lymphocytes/mm3.