Create a script that checks the cart value to see if it’s in the range of your specifications
If it’s in range, add that product to cart (that documentation will show you how) and show a message to let the user know it’s there (Example you can pop a message near the top, with a color that stands out and calls the user to go to their cart to see the free product).
Add an event listener to trigger the script when you want (probably after adding a product to the cart, unless your users always go to cart page before checking out, then you could add the check on cart page)
You probably want to create a script to remove the free product as well if the cart sizes diminishes under the threshold.
If you need help with part of this or want it done for you feel free to reach out to my team at speedboostr.com/contact, we’re a team of Shopify developers that do performance optimization, custom features, theme builds, and apps.