First of all you have to use a managed switch. If you are not using a managed switch, then nothing is stopping a person with sufficient privileges on individual machines from simply spoofing a MAC address of another machine. Once the MAC address is being spoofed, there is no way to tell the difference between the two.
With a managed switch you can either whitelist or blacklist certain combinations of switch port and MAC address. You can also install permanent entries in the CAM such that the switch won't learn them based on packets seen on the network.
This won't prevent ARP spoofing, but ARP spoofing is something you can look out for. More advanced managed switches may have features to prevent ARP spoofing (if you are going down that route, ensure the switch can also prevent ND spoofing, otherwise you are going to get some nasty surprises.)
Alternatively you can use the VLAN capability present on managed switches. By putting two switch ports in different VLANs, they are completely separated. This does mean that you need a router capable of routing between tagged VLANs.
A drawback of this approach is that all internal traffic between individual hosts has to go through the router. The link between switch and router can quickly become a bottleneck.
High end switches are actually hybrid router and switch in the same chip. Whether it behaves as a switch or a router entirely depend on configuration. This can address the bottleneck. You can reconfigure your switch to behave as a router instead.
This is really the direction to go if you want as much isolation as possible. Forget about switches and only use routers. Don't buy any switch unless it can be reconfigured as a router. For many use cases this would be overkill.