Relatively simple:
Your river presumably occupies two z-levels (really one, but it shows up on two): the surface, and a level underground.
Dig out your farm on the underground level of the river, a few tiles away from it and dig out a small tunnel to the river without breaking through it and having it flood all over.
Seal your farm room with a door or two from the rest of the fortress.
Make three mechanisms.
Use one to build a lever outside the farm room.
Make a floodgate.
Build the floodgate at the end of the tunnel leading to the river, next to the wall tile that separates the tunnel from the water on the other side.
Use the other two mechanisms to connect this floodgate to the lever.
Pull the lever, opening the floodgate, exposing the wall tile.
Have your miner break through to breach the river. He or she will high-tail it out of there and the room will proceed to flood. I recommend waiting until the water inundates approximately half of the room before pulling the lever again to seal the leak with the floodgate (though perhaps a little earlier since dwarves seldom get around to pulling a lever quickly enough).
The water will eventually evaporate and you'll have nice, farm-able mud! :3
To forgo any lingering confusion, here's a visual:
River flow controlled by a floodgate triggered by a lever. A lot easier to see than to thread it through a list.
The doors are there simply to contain the water from flooding out into the tunnels.