With the rapid development of wireless communication technology, radio technology has gradually come into people’s sight. The arrival of the information age also makes people more urgent to need radio technology. However, the allocation of traditional static wireless spectrum resources is extremely uneven, which leads to extreme scarcity of spectrum resources. Many authorized spectrum is idle and spectrum utilization is low. In order to improve the utilization of spectrum resources and make secondary use of idle spectrum, this paper studied the cognitive infinite agent Spectrum Allocation (SA) strategy based on Machine Learning (ML) algorithm and data science technology. This paper compared Cognitive Radio (CR) SA based on ML algorithm and data science technology with traditional methods. The experimental results showed that the average practicability of the two CR SA in the public mobile communication frequency band was 80% and 74% respectively; the average practicability in the terrestrial TV frequency band was 75% and 59.5% respectively. Therefore, CR SA based on ML algorithms and data science and technology could improve the practicability and resource utilization of spectrum.