Sean Murphy (24) and his friends pooled their money to buy the drugs and he was dividing the drugs out among them when he was searched by undercover gardai.
The court heard the drugs had a street value of €510.
Judge John Lindsay ordered Murphy to donate €1,000 to Coolmine Drug Treatment Centre and said he'd strike out the charges.
Murphy, of Burnaby Court in Greystones, Co Wicklow, admitted before Blanchardstown District Court to possession of cannabis herb and cocaine as well as having mephedrone for sale or supply.
The incident took place in the Phoenix Park shortly after 3pm on July 7.
Garda Sergeant Maria Callaghan said gardai were on plain-clothes patrol when they noticed Murphy who was constantly taking calls on his mobile phone.
Sgt Callaghan said Murphy then got into the passenger side of a car, went a short distance up the road, got out and walked back to where he had been standing with his friends.
The sergeant said gardai searched Murphy and found the drugs in his combat trousers.
Sgt Callaghan said Murphy had €350 worth of cocaine, €20 worth of cannabis herb and €140 worth of mephedrone.
Defence solicitor John O'Doherty said Murphy had never been in trouble before and admitted to the offences at the first opportunity.
Mr O'Doherty said Murphy was going to the concert with friends and they had all chipped in to buy the drugs.
The court heard the father-of-one works in a supermarket but in the future he hopes to travel to Australia to work.