How can I do that

Rectify with a bridge, small R/C filter, resistor voltage divider and perhaps a zener protection diode for good measure - that should cover signal conditioning. Dimension the R/C filter thus that you have sufficiently fast response, but minimum hum on the signal. You didn't mention the required response time, so can't comment on this further.

For the relay outputs, any generic Arduino-compatible relay board will do. Alternatively a bare relay with a suitable driver, such as a small signal mosfet (think 2n7000) + freewheel diode across the relay coil. If the relays need to be very heavy ones switching enormous loads, you may have to scale things up a bit. Depends on the load that's being switched, but it's not specified.

The code is straightforward and is simply based on analogRead's and if-statements. You could account for hysteresis in your code to prevent the relays from chattering if the voltage fluctuates around its limit. To an extent the R/C filter after the rectifier will also serve this function.

As you can see, your approach will depend on a number of yet unknown specifications, two of which I've highlighted above, but there are more, such as space constraints, presence of electrical supply for relays & control circuitry etc.