Hello. I'm not sure how to do this with Arduino libraries, but maybe I can give you a starting point by saying how you can do it with the mega168. If I were in your position, I would configure Timer/Counter1 (the 16-bit timer) to use the T1 pin as its clock source (see the mega168 datasheet). Every pulse on this pin will then increment the timer1 counter register TCNT1. You can check the value of TCNT1 at fixed intervals to get a measure of pulses/time, which you can in turn convert into a flow rate. The nice thing about this solution is that the pulse counting is done purely in hardware and hence doesn't hog processing cycles.
Another solution would be to interrupt on every incoming pulse and increment your own global pulse-count variable, but this would be much more processor-intensive, especially if you're dealing with high flow rates.