use of Soil Moisture sensor in a project

Not the cheap ones.

With a capacitive moisture sensor that has its electronics well covered/potted and with a good cable, then you can put that at any depth and also in water.
Perhaps you can make it yourself, or buy them.
At tindie.com they have a ruggedized version, it seems they used a glue-lined heatshrink for that.
I2C Soil moisture sensor from Catnip electronics on Tindie
SoilWatch 10 - Soil Moisture Sensor | Indiegogo
https://pino-tech.eu/product/soilwatch-10/
https://adosia.io/product/rugged-analog-soil-moisture-sensor/