It sounds like you have a defective HDD and your system is having trouble maintaining good communications (via the SATA interface) with it.
Try swapping your SATA cable (and verifying both ends are properly connected) first.
You can also try the HDD in another system to see if it does the same there.
It doesn't seem like it's the case. I swap the main hard drive and the 320gb hard drive sata cables. Hard drive is booting up fine and hard drive is still not getting detect.