It was a flop gone wrong for Japanese pole vaulter Hiroki Ogita -- when he ALMOST cleared the bar during a jump in Rio ... if not for his meddling penis.
While Ogita was midway through his jump on Saturday, his pocket Olympian got loose ... and unleashed his fleshy fury all over the bar ... knocking it off the stand.
He didn't get a medal ... but maybe some ice???