There is an increasing shortage of electromagnetic spectrum resources. For areas where a large number of electronic devices are distributed, the allocation of spectrum resources among electronic devices is the key issue. Aiming at the problem of spectrum resource allocation between electronic devices, this paper proposes a spectrum allocation algorithm based on the idea of proportional equity algorithm. The algorithm comprehensively considers the interference between the working frequency points of each device, electromagnetic environment constraints, device priority weight values, and the number of frequency points required by each device. Through the dynamic adjustment of the device allocation weight value during the allocation process, and constantly weighing the impact of the interference value of the current allocated frequency point, the algorithm proposed in this paper has become a fairer spectrum allocation algorithm. Simulation results show that the algorithm can effectively improve the fairness of spectrum allocation, and enhance the flexibility of the device to use the electromagnetic spectrum.