Long story short, you can have an instructor on board if you want but you can't log the time as training. And you can be under the hood if you want, as long as you're under the hood at night, in VFR conditions, and you're not logging it as training time.
Here's the relevant wording from 61.129:
Ten hours of solo flight time in a single engine airplane or 10 hours
of flight time performing the duties of pilot in command in a single
engine airplane with an authorized instructor on board
5 hours in night VFR conditions with 10 takeoffs and 10 landings (with each landing involving a flight in the traffic pattern) at an airport with an operating control tower
First, what about dual? "Dual" isn't an official FAA term but "training received" is and it means that an instructor endorsed your logbook to show that they provided training. So, does 61.129 allow you to use that training time? Well, by definition (61.51(d)) "solo" means that you're alone in the aircraft, so clearly "solo" and "training received" can't happen at the same time.
That leaves "performing the duties of pilot in command in a single engine airplane with an authorized instructor on board". According to the Kuhn (2014) legal interpretation, you can have an instructor on board but you can't log it as training received:
Because this flight time is a substitute for solo flight time, the
pilot is not receiving instruction and therefore cannot log this time
as dual instruction received. The pilot can log the time to meet the
requirements of § 61.129(a)(4) and log total flight time
Whether you want to pay a CFI to just sit there without you being able to log training time is up to you. The CFI can still log PIC time, by the way, according to the same interpretation.
Summing up the dual part, you cannot use training time as solo time. To meet the requirements in 61.129 you have two options: be alone in the aircraft, or have an instructor on board but not log any training time.
Second, what about hood time? "Night VFR conditions" describes the flight conditions but doesn't say anything about what happens inside the aircraft. I don't see anything that says you can't be under the hood with a safety pilot as long as you're also flying in night VFR conditions. In other words, being under the hood during daytime doesn't count: the requirement is to be in night VFR conditions.