I remember doing something somewhat like this with Redpower 2 long ago, back in Mindcrack.
I was automating a GregTech Fusion Reactor, and I wanted exactly one in five deuterium cells to go into the reactor, and the rest to go into a bank of centrifuges for refinement into tritium. Deuterium coming from another bank of centrifuges (via RP2 pneumatic tubes) passed through a RP2 item detector set to the mode where it pulses once for each item passing through. These items dumped straight into a chest with two RP2 filters on it, one set to pull one cell to shove into the reactor and the other set to pull four cells to shove into the centrifuges.
The setup also included an RP2 counter circuit configured to increment by 1, decrement by 5, and max out at 5. Its '+' input was wired to the item detector, and its '+' output was wired to its own '-' input and both of the filters. So, whenever an item entered the chest via the detector, it incremented the counter, and after five items (and five increments), the timer reset itself and instructed the one filter to pull one cell and the other to pull the other four.
But, as for solutions to your specific problem that use updated mods, a ComputerCraft turtle script is probably one of the easiest, at least if you know some LUA. It should be able to read the size of item stacks in its inventory, then drop four of them if there are at least that many.
I don't think that Buildcraft gates can read an exact number of items. If they could, though, you could use a wooden pipe with a gold autarchic gate with "At least four items in inventory -> Energy Pulser" configured into it exactly three times. Each simultaneously triggering energy pulser after the first doubles the number of items it pulls at once, so with three (the first one, then the other two), it will pull four items at once.
You might, however, have to resort to a Vanilla comparator to determine when the chest contains some items. For a vanilla single chest, it emits a redstone signal of strength 1 when there is only one item, but won't increase its output to strength 2 until there are nearly two stacks of items. Probably better to use something with a smaller inventory as your buffer, then wire it to an Itemduct set to max stack size 4 that's set to extract items when given a redstone signal. Or, for that matter, a wooden pipe with an autarchic gate with "Redstone signal -> Energy Pulser" entered in three times.