Urban wastelands are important substitute habitats for many insect species, but their value for the protection of wild bees is still poorly studied. We assessed species richness, abundance, and the diversity of wild bees in wastelands that differed in area (2–35 ha), stage of ecological succession, location (suburbs or closer to the city centre), and history of land use. In the investigated plots, we recorded 42% of all bee species reported from Poland. The attractiveness of wastelands was positively correlated with the coverage of blooming herbs, coverage of shrubs and low trees, and the area of the wasteland. An increase in isolation of the habitat patches, the percentage contribution of alien species, annuals, and low grasses (< 25 cm) negatively affected the diversity of Apiformes. Considering the history of land use, we found that the bees were most attracted to wastelands resulting from extractive industry (sand and clay pits), and grassy habitats located in the suburbs, e.g. at sites grazed earlier by sheep. Wastelands in areas directly influenced by the chemical industry were the least attractive to bees. Analyses of quantitative and qualitative similarity of bees in various habitat types showed that three habitat types were the most similar to grasslands in the suburbs (the least disturbed habitats): degraded grasslands located closer to the city centre, extraction pits, and old fields. The presented results indicate that urban wastelands, including some post-industrial sites, can be important secondary habitats for wild bees. Thus, proper management of urban natural resources should cover both the formally managed areas and the so-called unproductive spaces, which have been undervalued so far.