You can detect the presence of a water stream using a boat and a wooden pressure plate. Place a boat on top of a pressure plate, with walls around it so that it cannot be washed away. If water flows under the boat (in the space not occupied by the pressure plate) at at least water level 3 (out of the 8 possible water levels), it will float up and stop activating the pressure plate.
Here is an example mechanism making a clock out of this. The pressure plate controls the piston to turn on the water whenever the boat is on the plate, so it cycles forever (pictured in the middle of shutting off).
Note that in current versions, boats have visual glitches and may appear to escape the box, especially if you put a lid on top. Don't worry about them — the mechanism will still function fine.
In your case, simply make a channel leading the water out of the bottom of your farm and into a detector like the left half of my picture, and you can then send the redstone output up to shut off the water. Of course, for farming you'll want it to not turn the water back on when the bottom dries up, so add a classic flip-flop:
This will turn the water on when the button is pressed, and turn the water off when the boat detects water.