Co-based metallic glasses (MGs) are a new class of soft magnetic materials, which have promising application value in high-frequency fields due to their high magnetic permeability and low coercivity. However, these kinds of MGs have poor glass-formation ability (GFA) and relatively low saturated magnetic flux density, so their application scope is limited. The atomic size of metalloid elements <i>M</i> (B, C, Si, and P) is small, which can easily enter the gap between atoms, and there is a relatively large negative enthalpy of mixing between metalloid elements and metal elements. Therefore, alloying with metalloid elements <i>M</i> is an effective method to improve the GFA while maintaining superior soft magnetic properties for Co-based MGs. In this paper, the formation process of Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub><i>M</i><sub>10</sub> (<i>M</i>=B, C, Si, P) MGs was simulated by <i>ab initio</i> molecular dynamics (AIMD) methods, and the effects of the addition of metalloid elements <i>M</i> (C, Si, P) on the GFA and magnetic properties of Co-Y-B MGs have been investigated. It is devoted to analyzing the relationship between local atomic structures and properties from different perspectives at the atomic level.<br>According to the results of the characterization parameters of local atomic structures (pair distribution function, coordination numbers, chemical short-range order, Voronoi polyhedron index, local five-fold symmetry, and mean square displacement), it is found that the GFA of the four alloys is different due to their different local atomic structures. Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>C<sub>10</sub> and Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>P<sub>10</sub> alloys possess a higher fraction of prism structures, and the solute segregation between B/C-C and B/P-P atoms is weak, resulting in the higher atomic diffusivity in the supercooled state (1100 K), and hence weaken the GFA of the alloys. The Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>Si<sub>10</sub> alloy has a higher fraction of icosahedral-like structures, the stronger attraction between Co-Si atoms and solute segregation between B/Si-Si atoms reduce the atomic diffusivity in the supercooled state, whilst improving the thermal stability of alloy melts, stability of the local atomic structures, and the degree of five-fold symmetry, thereby increasing the GFA. Based on the analysis of the local atomic structures, it is speculated that the addition of Si is beneficial for enhancing the GFA, while the addition of C or P will reduce the GFA, that is, the GFA of the four alloys decreases in the order of Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>Si<sub>10</sub> > Co<sub>72</sub>Y<sub>3</sub>B<sub>25</sub> > Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>P<sub>10</sub> > Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>C<sub>10</sub>. In terms of magnetic properties, with metalloid elements <i>M</i> addition, the total magnetic moment of Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub><i>M</i><sub>10</sub> (<i>M</i>=B, C, Si, P) alloys decreases as follows Co<sub>72</sub>Y<sub>3</sub>B<sub>25</sub> > Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>Si<sub>10</sub> > Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>C<sub>10</sub> > Co<sub>72</sub>Y<sub>3</sub>B<sub>15</sub>P<sub>10</sub>. The stronger p-d orbital hybridization between Co-Si atoms enhances the ferromagnetic exchange interaction, leading to the total magnetic moment less affected by Si addition.